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', 'From'); data.addColumn('string', 'To'); data.addColumn('number', 'Weight'); data.addRows([ [ 'Brazil', 'Paris', 5 ], [ 'Brazil', 'France', 1 ], [ 'Brazil', 'Spain', 2 ], [ 'Brazil', 'China', 3 ], [ 'Canada', 'Paris', 4 ], [ 'Canada', 'France', 5 ], [ 'Canada', 'Spain', 1 ], [ 'Mexico', 'Paris', 2 ], [ 'Mexico', 'France', 3 ], [ 'Mexico', 'Spain', 5 ], [ 'Mexico', 'China', 1 ], [ 'USA', 'Paris', 2 ], [ 'USA', 'France', 3 ], [ 'USA', 'Spain', 4 ], [ 'USA', 'China', 5 ], [ 'Portugal', 'Angola', 2 ], [ 'Portugal', 'japan', 5 ], [ 'Portugal', 'Morocco', 4 ], [ 'Portugal', 'South Africa', 3 ], [ 'France', 'Angola', 1 ], [ 'France', 'japan', 3 ], [ 'France', 'Mali', 2 ], [ 'France', 'Morocco', 4 ], [ 'France', 'South Africa', 5 ], [ 'Spain', 'japan', 1 ], [ 'Spain', 'Morocco', 2 ], [ 'Spain', 'South Africa', 3 ], [ 'England', 'Angola', 4 ], [ 'England', 'japan', 5 ], [ 'England', 'Morocco', 2 ], [ 'England', 'South Africa', 7 ], [ 'South Africa', 'los angeles', 5 ], [ 'South Africa', 'India', 2 ], [ 'South Africa', 'Malaysia', 3 ], [ 'Angola', 'los angeles', 5 ], [ 'Angola', 'India', 4 ], [ 'Angola', 'Malaysia', 3 ], [ 'Senegal', 'China', 5 ], [ 'Senegal', 'India', 2 ], [ 'Senegal', 'Malaysia', 3 ], [ 'Mali', 'los angeles', 5 ], [ 'Mali', 'India', 4 ], [ 'Mali', 'Malaysia', 3 ], [ 'Morocco', 'los angeles', 5 ], [ 'Morocco', 'India', 2 ], [ 'Morocco', 'Malaysia', 3 ] ]); // 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