Kaushik Chakraborty Kaushik Chakraborty - 3 months ago 24
jQuery Question

Error in highstock chart. Data is undefined in tooltip

I am trying to build a highstock chart where I have a set of timestamps in x axis and numbers in y axis. Also I have some other data in the array which I would like to show during in the tooltip. The data array is like below:

data=[
{
"ID": 9682533,
"PONumber": "100869279",
"y": 2,
"x": 1470196365449
},
...];


and the tooltip formatter function is:

tooltip: {

formatter: function () {

console.log('inside formatter');
var s = '<b>' + Highcharts.dateFormat('%A, %b %e, %Y, %H:%M:%S', this.x) + '</b>';

$.each(this.points, function () {
s += '<br/> ID:= <b>'
+ this.point.ID
+ '</b><br/> Completion time:= <b>'
+ this.y
+ ' secs</b><br/>'
+ 'Purchase Order Number:= <b>'
+ this.point.PONumber
+ '</b><br/>';
});

return s;

}
}


When I plot the data however I get the value of ID and Purchase Order Number as undefined. When I zoom the data however I get to see the correct data in tooltip. The jsfiddle is here: http://jsfiddle.net/jayadrath/v8mLc8np/. Any help to solve this issue will be great.

Edit: Some answers and comments have mentioned that they cannot see the issue. Hence attaching screenshot.

Highstock data issue

Answer

I also cannot reproduce on your fiddle - tooltip shows and no error on tooltip values undefined in console.

Is the fiddle data all of the data or is this just a sample? I am wondering if the issue has to do with dataGrouping being enabled on your chart and there being much more data. If dataGrouping is on there is some approximation done on your x/y values and it probably is not getting your other tooltip items transferred to the point.

Try turning off dataGrouping.

Comments