Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Highcharts - How to hide series name and Y value in tooltip

Hovering over a series in Highchart graph displays a popup with series name and Y value, in the example: 'Tokyo 9.5ºC'. I would like to display my own, custom text on hover - I can do that by modifying each point's name. At the same time I would like to hide the default series name and Y value. I've searched the doc but haven't found anything suitable. Any ideas how to approach this?

like image 551
Bartek Skwira Avatar asked Apr 05 '13 09:04

Bartek Skwira


2 Answers

You'll have to specify a tooltip formatter yourself (see documentation):

tooltip: {
  formatter: function() {
    return 'The value for <b>'+ this.x +
           '</b> is <b>'+ this.y +'</b>';
  }
},

there you can just show the x-values if you like or your custom text.
Hope that helps.

like image 124
dgw Avatar answered Oct 13 '22 01:10

dgw


I have modified the DEMO and created a new DEMO here

To customize the text displayed in the tooltip, you should use it like:

Highcharts.chart('container', {

    title: {
        text: 'Solar Employment Growth by Sector, 2010-2016'
    },

    subtitle: {
        text: 'Source: thesolarfoundation.com'
    },
........
.....
....

    tooltip: {
      formatter: function() {
        return '<strong>X value: </strong>'+ this.x;
      }
    },
}); 
like image 26
Rahul Gupta Avatar answered Oct 12 '22 23:10

Rahul Gupta