Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable tooltip on certain points in Highcharts

Tags:

I have a Highcharts line chart going and I have tooltips enabled, however, I would like to disable tooltips for the certain case where x=0. Is there a way of doing this? The closest that I have come so far is this:

tooltip: {
    formatter: function() {
        if (this.x > 0) {
            return this.x;
        }
        else return null;
    }
}

This just creates an empty tooltip but there is still a popup.

like image 213
Allen Liu Avatar asked Jan 09 '12 08:01

Allen Liu


People also ask

How to disable tooltip in Highcharts?

Return false to disable tooltip for a specific point on series.

What is tooltip in Highcharts?

The tooltip appears when hovering over a point in a series. By default the tooltip shows the values of the point and the name of the series. For the full set of options available for the tooltip, see the API reference.

What is Formatter in Highcharts?

A callback function for formatting the HTML output for a single point in the tooltip. Like the pointFormat string, but with more flexibility. Defaults to undefined . Context: Highcharts. Point.


1 Answers

Ok...just figured it out. I just have to return false instead of null.

tooltip: {
    formatter: function() {
        if (this.x > 0) {
            return this.x;
        }
        else return false;
    }
}
like image 62
Allen Liu Avatar answered Sep 23 '22 02:09

Allen Liu