Novis
Novis

Reputation: 660

How to hide one series data info in tooltip using highcharts

Hi I am getting a following chart:enter image description here

I want to hide the water info from the tooltip. How can I do that. You can use the following fiddle to play with it.

Thanks!!!

Upvotes: 3

Views: 2795

Answers (2)

ibschreiber
ibschreiber

Reputation: 151

No need to customize the tooltipfunction. just add this to the series object which should be hidden:

'tooltip'=> [
            'pointFormat'=> ''
          ]

Upvotes: 2

wergeld
wergeld

Reputation: 14462

You were almost there. You needed to check the api for the shared tooltip formatter. Put your check for the series you do not want inside the for each:

...
            tooltip: {
                formatter: function () {
                    var s = '<b>' + this.x + '</b>';
                    $.each(this.points, function () {
                        if (this.series.name != 'Water') {
                            s += '<br/>' + this.series.name + ': ' + this.y + 'm';
                        }                       
                    });
                    return s;
                },
                shared: true,
                valueSuffix: ' cm'

            },
...

Upvotes: 7

Related Questions