User avatar
rikiki
Posts: 10
Joined: Thu Jun 18, 2015 9:21 am

enable / disable tooltip dynamically

Hi,
How can I disable / enable
tooltip while the graph is displayed?
User avatar
KacperMadej
Posts: 4632
Joined: Mon Sep 15, 2014 12:43 pm

Re: enable / disable tooltip dynamically

Tooltip can be hidden dynamically through tooltip's formatter function - if it will return false, then tooltip will be hidden.
Example: http://jsfiddle.net/31xp54z4/
Kacper Madej
Highcharts Developer
cemgokhan99
Posts: 3
Joined: Tue Sep 28, 2021 1:30 pm

Re: enable / disable tooltip dynamically

Hi,
Any tips on how to do this so the tooltip gets enabled on a certain point on the chart?
For example by passing in a condition and the index of the point in the formatter function.
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: enable / disable tooltip dynamically

Hi cemgokhan99,

Welcome to our forum and thanks for contacting us with your question!

Do you mean something like this?
https://jsfiddle.net/BlackLabel/g0c7pxsq/

Let me know if it was what you were looking for.
Regards!
Mateusz Bernacik
Highcharts Developer
cemgokhan99
Posts: 3
Joined: Tue Sep 28, 2021 1:30 pm

Re: enable / disable tooltip dynamically

Hi,

Thanks for the quick answer.
This is partly what I am looking for, would it be possible to display the tooltip on that point without actually having to hover over it first?
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: enable / disable tooltip dynamically

Hi cemgokhan99,

Should the tooltip be visible all the time or should it appear / disappear after a specific event?

Regards!
Mateusz Bernacik
Highcharts Developer
cemgokhan99
Posts: 3
Joined: Tue Sep 28, 2021 1:30 pm

Re: enable / disable tooltip dynamically

I have a series with just one point in it, that series change with a dynamic event from outside the chart. However I want the tooltip to be always visible on that point for that series.

edit: I believe an easier solution would be to use something like dataLabels on that series.
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: enable / disable tooltip dynamically

Hi cemgokhan99,

Tooltip is generated dynamically so it can be troublesome in some situations, but here is a demo showing how to do something like that:
https://jsfiddle.net/BlackLabel/tgzjwnqf/

As you said easier and more consistent solution is to show a data label for that one specific point. The label content can be adjusted with formatter callback function:
https://jsfiddle.net/BlackLabel/c75L46uw/

API reference: https://api.highcharts.com/class-refere ... ip#refresh,
https://api.highcharts.com/highcharts/p ... .formatter

Let me know if it was what you were looking for.
Regards!
Mateusz Bernacik
Highcharts Developer

Return to “Highcharts Stock”