Highcharts Demo
author(s): Torstein Hønsi
by Mi Ku
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<div id="container"></div>
CSS
#container {
min-width: 300px;
max-width: 800px;
margin: 0 auto;
}
JavaScript
Highcharts.chart('container', {
chart: {
type: 'column'
},
title: {
text: 'Highcharts with a split tooltip formatter'
},
xAxis: {
categories: [
'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
],
crosshair: true
},
tooltip: {
formatter: function () {
// The first returned item is the header, subsequent items are the
// points
return
this.points ?
this.points.map(function (point) {
console.log('point');
return point.series.name + ': ' + point.y + 'm';
}) : [];
},
shared: true,
split: true
},
series: [{
data: [0, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}, {
data: [216.4, 0, 95.6, 54.4, 29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5]
}]
});