Always Visible Tooltip | Highcharts @ A Humble Opinion
http://stackoverflow.com/questions/12313935/never-want-to-hide-tooltip-on-highcharts/12315846#comment16529080_12315846
Jugal Thakkar
http://jugal.me/
by Muhammad Mushtaq Sheikh
HTML
<script src="https://code.highcharts.com/highcharts.src.js"></script>
<div id="container"></div>
CSS
#container {
min-width: 500px;
}
JavaScript
(function(H) {
H.wrap(H.Tooltip.prototype, 'hide', function(defaultCallback) {
//alert();
//if ( /* .. */ ) {
////Do Nothing (Do Not Hide)
//} else { // Call the default Hide Callback
//defaultCallback.apply(this);
//}
});
H.wrap(H.Tooltip.prototype, 'click', function(defaultCallback) {
alert('click');
});
//Highcharts.wrap(Highcharts.Tooltip.prototype, 'refresh', function(proceed, point, event, click) {
// if (click) {
// proceed.apply(this, Array.prototype.slice.call(arguments, 1));
// }
//});
}(Highcharts));
var tooltips;
var chart = $('#container').highcharts({
title: {
text: 'Monthly Average Temperature'
},
events: {
load: function() {}
},
plotOptions: {
series: {
stickyTracking: false,
point: {
events: {
mouseOver: function() {
var dd = this;
console.log(this);
//alert('over');
// chart.tooltip.hide();
debugger; chart.tooltip.refresh(chart.series[0].points[this.index]);
//this.chart.myTooltip.options.enabled = true;
//this.chart.myTooltip.refresh(evt.point, evt);
}
}
},
events: {
mouseOut: function() {
//alert('out');
}
}
}
},
credits: {
text: "Jugal Thakkar",
href: "http://jugal.me/"
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
yAxis: {
title: {
text: 'Temperature (°C)'
}
},
series: [{
name: 'Islamabad',
data: [24.2, 24.6, 26.7, 28.6, 30.1, 29.0, 27.5, 27.2, 27.4, 28.2, 27.4, 25.6]
}],
tooltip: {
snap: 0,
formatter: function(tooltip) {
//console.log(tooltip);
return tooltip.defaultFormatter.call(this, tooltip);
},
valueSuffix: '°C'
...