Highcharts Demo
author(s): Torstein Hønsi
by arvillarruel
HTML
<script src="http://code.highcharts.com/highcharts.js"></script>
<div id="container"></div>
<button id="button">Destroy the chart</button>
JavaScript
$(function () {
$('#container').highcharts({
chart: {
type:'column'
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
tooltip: {
useHTML: true,
borderWidth: 1,
},
plotOptions: {
series: {
stickyTracking: false,
events: {
mouseOver() {
const color = arguments[0].target.color;
this.chart.tooltip.options.backgroundColor = color; //first time overwrite
setTimeout(() => {
const tooltipMainBox = document.querySelector(`g.highcharts-tooltip path:last-of-type`);
if (tooltipMainBox) {
tooltipMainBox.setAttribute('fill', color);
}
});
}
}
}
},
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
},{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
},{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}]
});
});