Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Never want to hide tooltip on highcharts

I am using HighCharts in my ASP.Net MVC application using JQuery.

I have managed to show a tooltip with crosshair vertical bar on mouse move. However, I do not want to hide this toolop + bar even if user moves the mouse out of chart. Is there any option available in Highcharts to achieve this?

I searched forums but could not find any working example. One of those solutions is related to cloning tooltip on click event.

like image 761
Anil Soman Avatar asked Nov 28 '22 01:11

Anil Soman


1 Answers

You can wrap the Highcharts.Tooltip.prototype.hide by an empty (no-op) function as follows

(function (H) {
    H.wrap(H.Tooltip.prototype, 'hide', function (defaultCallback) {
        /*
            ░░░░░▄▄▄▄▀▀▀▀▀▀▀▀▄▄▄▄▄▄░░░░░░░
            ░░░░░█░░░░▒▒▒▒▒▒▒▒▒▒▒▒░░▀▀▄░░░░
            ░░░░█░░░▒▒▒▒▒▒░░░░░░░░▒▒▒░░█░░░
            ░░░█░░░░░░▄██▀▄▄░░░░░▄▄▄░░░░█░░
            ░▄▀▒▄▄▄▒░█▀▀▀▀▄▄█░░░██▄▄█░░░░█░
            █░▒█▒▄░▀▄▄▄▀░░░░░░░░█░░░▒▒▒▒▒░█
            █░▒█░█▀▄▄░░░░░█▀░░░░▀▄░░▄▀▀▀▄▒█
            ░█░▀▄░█▄░█▀▄▄░▀░▀▀░▄▄▀░░░░█░░█░
            ░░█░░░▀▄▀█▄▄░█▀▀▀▄▄▄▄▀▀█▀██░█░░
            ░░░█░░░░██░░▀█▄▄▄█▄▄█▄████░█░░░
            ░░░░█░░░░▀▀▄░█░░░█░█▀██████░█░░
            ░░░░░▀▄░░░░░▀▀▄▄▄█▄█▄█▄█▄▀░░█░░
            ░░░░░░░▀▄▄░▒▒▒▒░░░░░░░░░░▒░░░█░
            ░░░░░░░░░░▀▀▄▄░▒▒▒▒▒▒▒▒▒▒░░░░█░
            ░░░░░░░░░░░░░░▀▄▄▄▄▄░░░░░░░░█░░
            */
    });
}(Highcharts));

Highcharts/Highstock tooltip always visible @ JsFiddle

For the minimalists,

(function (H) {
    H.wrap(H.Tooltip.prototype, 'hide', function () {});
}(Highcharts));

does the job too ;)

Read More @ Customizing Highcharts - Tooltip Visibility

like image 58
Jugal Thakkar Avatar answered Dec 09 '22 21:12

Jugal Thakkar