Create sankey chart - Javascript highcharts

Javascript examples for highcharts:Chart Creation

Description

Create sankey chart

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Highcharts Demo</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <style id="compiled-css" type="text/css">

#container {/*from  w  w  w .jav  a 2s  .  com*/
   min-width: 300px;
   max-width: 800px;
   height: 400px;
   margin: 1em auto;
   border: 1px solid silver;
}
#csv {
   display: none;
}


      </style> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <script src="https://code.highcharts.com/modules/sankey.js"></script> 
      <script src="https://code.highcharts.com/modules/exporting.js"></script> 
      <div id="container"></div> 
      <script type="text/javascript">
var chart= Highcharts.chart('container', {
    title: {
        text: 'Highcharts Sankey Diagram'
    },
    series: [{
        keys: ['from', 'to', 'weight'],
        data: [
            ['Brazil', 'Portugal', 2 ],
            ['Brazil', 'Germany', 3],
            ['Canada', 'Portugal', 1 ],
            ['Canada', 'France', 1 ],
            ['USA', 'England', 4 ],
            ['England', 'Germany', 3]
        ],
         dataLabels: {
             borderWidth: 1,
             backgroundColor: 'rgb(224, 236, 255)',
             borderRadius: 5,
             style: {
                fontSize: '1em'
            }
        },
        useHTML:'true',
        type: 'sankey',
        name: 'Sankey demo series'
    }]
});

      </script>  
   </body>
</html>

Related Tutorials