Highcharts Demo
author(s): Sebastian Bochan
by Black Label
HTML
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/sankey.js"></script>
<div id="container"></div>
JavaScript
Highcharts.chart('container', {
chart: {
events: {
load() {
this.series[0].points.forEach(point => {
if (point.weight === 0) {
point.update({
weight: 0.1,
color: 'transparent'
})
}
})
}
}
},
tooltip: {
nodeFormatter: function() {
return `${this.name}: <b>${Math.floor(this.sum)}</b><br/>`
},
pointFormatter: function() {
return `${this.fromNode.name} → ${this.toNode.name}: <b>${Math.floor(this.weight)}</b><br/>`
}
},
series: [{
keys: ['from', 'to', 'weight', 'color'],
data: [
['Brazil', 'Portugal', 0],
['Brazil', 'France', 1],
['Brazil', 'Berlin', 0],
['Brazil', 'Warsaw', 2],
],
type: 'sankey',
}]
});