Node arrangement

by applewil

HTML

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/sankey.js"></script>

<button id="plot-button">Plot chart</button>
<button id="reflow-button">Reflow chart</button>
<div id="container"></div>

JavaScript

var width = 300;
var height = 200;
var chart;

document.getElementById('plot-button').addEventListener('click', () => {
  chart = Highcharts.chart('container', {
    chart: {
      width: width,
      height: height
    },
    series: [{
      keys: ['from', 'to', 'weight'],
      data: [
        ['a', 'd', 1],
        ['b', 'c', 1],
        ['c', 'd', 1]
      ],
      type: 'sankey'
    }]
  });
});

document.getElementById('reflow-button').addEventListener('click', () => {
  chart.setSize(width, height);
});