Code
Execute
<!DOCTYPE html> <html> <head> <title>Google Charts tutorial Tutorial</title> <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> google.charts.load('current', {packages: ['sankey']}); </script> </head> <body> <div id="container" style="width: 550px; height: 400px; margin: 0 auto"></div> <script language="JavaScript"> function drawChart() { // Define the chart to be drawn. var data = new google.visualization.DataTable(); data.addColumn('string', 'Start'); data.addColumn('string', 'End'); data.addColumn('number', 'Weight'); data.addRows([ [ 'New York', 'Paris', 4 ], [ 'New York', 'France', 2 ], [ 'New York', 'Spain', 3 ], [ 'New York', 'England', 6 ], [ 'Canada', 'Paris', 2 ], [ 'Canada', 'France', 4 ], [ 'Canada', 'England', 2 ], [ 'Los Angeles', 'Paris', 3 ], [ 'Los Angeles', 'France', 5 ], [ 'Los Angeles', 'Spain', 4 ], [ 'Los Angeles', 'England', 2 ], [ 'USA', 'Paris', 3 ], [ 'USA', 'France', 6 ], [ 'USA', 'Spain', 5 ], [ 'USA', 'England', 4 ] ]); // Set chart options var options = { width: 550 }; // Instantiate and draw the chart. var chart = new google.visualization.Sankey(document.getElementById('container')); chart.draw(data, options); } google.charts.setOnLoadCallback(drawChart); </script> </body> </html>
Result