Sankey Example

An example of a Google Sankey Chart.

HTML

<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
       <div id="sankey_basic" style="width: 900px; height: 300px;"></div>
       <br>
       
				<table id="timeLineTable" style="width: 1200px;">
				<tbody><tr>
				<td align="left">Jan 2016</td><td align="left">Feb 2016</td>
				</tr>
			</tbody></table>

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', '#Customers');
        data.addRows([
          [ 'Group A', 'Group X', 5 ],
          [ 'Group A', 'Group Y', 7 ],
          [ 'Group A', 'Group Z', 6 ],
          [ 'Group B', 'Group X', 2 ],
          [ 'Group B', 'Group Y', 9 ],
          [ 'Group B', 'Group Z', 4 ]
        ]);

        // Sets chart options.
        var options = {
          width: 600,
        };

        // Instantiates and draws our chart, passing in some options.
        var chart = new google.visualization.Sankey(document.getElementById('sankey_basic'));
        chart.draw(data, options);
      }