google.setOnLoadCallback(drawChart); function drawChart() { var data = new google.visualization.DataTable(); data.addColumn('string', 'From'); data.addColumn('string', 'To'); data.addColumn('number', 'Gecis'); data.addRows([ [ 'AKP (49.9)', 'AKP (40.9)', 38.05 ], [ 'AKP (49.9)', 'CHP (25.1)', 1.52 ], [ 'AKP (49.9)', 'MHP (16.4)', 3.11 ], [ 'AKP (49.9)', 'HDP (13.1)', 4.04 ], [ 'CHP (26)', 'CHP (25.1)', 21.55 ], [ 'CHP (26)', 'HDP (13.1)', 1.46 ], [ 'MHP (13)', 'MHP (16.4)', 11.84 ], [ 'HDP (6.5)', 'HDP (13.1)', 6.6 ], [ 'Others (5.6)', 'Others (4.5)', 0.9 ], [ 'Others (5.6)', 'AKP (40.9)', 1.42 ], [ 'Others (5.6)', 'CHP (25.1)', 1.1 ], [ 'Others (5.6)', 'CHP (25.1)', 1.1 ], [ 'Others (5.6)', 'MHP (16.4)', 0.62 ], [ 'AKP (49.9)', 'Others (4.5)', 3.28 ], [ 'CHP (26)', 'Others (4.5)', 0.84 ], [ 'CHP (26)', 'MHP (16.4)', 0.67 ], [ 'CHP (26)', 'AKP (40.9)', 1.45 ], [ 'MHP (13)', 'CHP (25.1)', 0.66 ] ]); // Sets chart options. var colors = [ '#fdbf6f','#fdbf6f','#fb9a99', '#b2df8a', '#cab2d6','#fb9a99', '#b2df8a', '#cab2d6', '#a6cee3', '#a6cee3']; var options = { height: 400, width: 400, sankey: { node: { colors: colors, fillOpacity: 1, label: { fontSize: 13, bold: true} }, link: { colorMode: 'gradient', colors: colors } } }; // Instantiates and draws our chart, passing in some options. var chart = new google.visualization.Sankey(document.getElementById('sankey_basic')); chart.draw(data, options); }
<script type="text/javascript" src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1.1','packages':['sankey']}]}"></script> <div id="sankey_basic" style="width: 900px; height: 300px;"></div>