Highcharts: tooltip Click instead of hover

2019-01-28 13:15发布

问题:

Is there a setting for highcharts tooltips where you can set it to display on click versus hover?

I have seen a lot of people discussing the tooltip staying on click but then there is still the hover present. Is there a way to disable the hover and use only click?

回答1:

There is not a setting for that in Highcharts currently.

There is a feature request for this functionality here: http://highcharts.uservoice.com/forums/55896-general/suggestions/2607304-allow-the-tooltip-to-appear-when-a-point-is-clicke

Feel free to add your votes and comments.

UPDATE:

I have started using the jquery UI dialog for this purpose. I disable the tooltip in Highcharts, and add a click event to the point in the plotOptions.

In that click function I call an external function, sending it the point object, and build my tooltip within the dialog.

  • http://jqueryui.com/dialog/
  • http://api.highcharts.com/highcharts#plotOptions.series.point.events.click

You could also use Highslide for this purpose, and keep it all in the family.

  • http://highslide.com/

Working example:

  • http://jsfiddle.net/jlbriggs/LHZ3E/embedded/result/


回答2:

Adding for those who has problems like me with useHTML: true and wants to display tooltip only on click and not on hover and wants to have only one tooltip on screen.

Here is a fiddle.



标签: highcharts