<script type="text/javascript">
google.charts.load("current", {packages:['sankey', 'wordtree']});
google.charts.setOnLoadCallback(drawSankeyChart);
function drawSankeyChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'From');
data.addColumn('string', 'To');
data.addColumn('number', 'Weight');
data.addRows([
...
]);
// Set chart options
var options = {
width: 1000,
tooltip: {
trigger: 'selection'
}
};
var chart = new google.visualization.Sankey(document.getElementById('sankey_multiple'));
chart.setAction({
id: 'remove',
text: 'Remove',
action: function() {
selection = chart.getSelection();
alert(selection[0].row + 'will be removed');
}
});
chart.draw(data, options);
};
...