I am struggling to download my sankey diagram built with google charts as a png/jpg with the clickButton. I have deeply screened other Q&A and tried with purposed examples but I did not get anything working. Can anyone suggest me how to proceed?
I attach the classic sankey version I am using to depict my diagram.
Thanks to help me.
<html>
<body>
<div id="sankey_basic" style="width: 900px; height: 300px;"></div>
<script type="text/javascript"src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {'packages':['sankey']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'From');
data.addColumn('string', 'To');
data.addColumn('number', 'Weight');
data.addRows([
[ 'A', 'X', 5 ],
[ 'A', 'Y', 7 ],
[ 'A', 'Z', 6 ],
[ 'B', 'X', 2 ],
[ 'B', 'Y', 9 ],
[ 'B', 'Z', 4 ]
]);
// Sets chart options.
var options = {
width: 600,
};
var chart = new google.visualization.Sankey(document.getElementById('sankey_basic'));
chart.draw(data, options);
}
</script>
</body>
</html>