1
votes

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

2
Dear Kaushik, I do not understand your problem. I am trying your code in jsfiddle and I can see correctly the values of ID and Puchase Order in the tooltip without using the zoom. Please, can you explain in greater detail the problem ? - Marco Sandri
Added a screenshot for the same - Kaushik Chakraborty

2 Answers

3
votes

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.

0
votes

This cannot work since Highstock is only retrieving and using the x and y values from your data object + you are refering to this.point.ID/PONumber that doesnt exist.

Here is a console.log(this) output of "this".

Object {x: 1470196320000, y: 2, points: Array[1]}

points:Array[1]

x:1470196320000

y:2