Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

highcharts pass multiple values to tooltip

Tags:

I need to display 3 values on the tooltip: the time, the value and another value(change).

I saw this example (but the jsdfiddle is not working).

I tried this

//each loop.. indice.push(["time", "value1", "value2"]); 

, the tooltip settings

tooltip:     {     useHTML: true,     formatter: function()     {       return '' + Highcharts.dateFormat('%H:%M:%S', this.x) +'; '+ this.y + this.z(<-is this right?);     } }, 

and the series

series: [{     type: 'area',     data: indice }] 

can somone help pls? thsnks.

like image 480
devmonster Avatar asked Jul 02 '12 13:07

devmonster


1 Answers

If you want to pass additional data for a point other than the x and y values, then you have to name that value. In the following example I add the following three additional values to each data point:

{   y: 3,   locked: 1,   unlocked: 1,   potential: 1, } 

Then to access and display those values in the tooltip I use the following:

tooltip:  {      formatter: function() { return ' ' +         'Locked: ' + this.point.locked + '<br />' +         'Unlocked: ' + this.point.unlocked + '<br />' +         'Potential: ' + this.point.potential;      } } 
like image 98
Linger Avatar answered Sep 16 '22 17:09

Linger