user1757006
user1757006

Reputation: 775

Cannot read property 'info' of undefined

I am having an issue where I get the error in the title of this question when I create a chart like the one in this fiddle http://jsfiddle.net/w43m47hL/.

I get this problem when selecting a point.

this.select();

The problem occurs when performing these steps.

  1. create the chart
  2. click on a point to select it
  3. destroy the chart
  4. create the chart again

The size of the data set seems to have something to do with the problem. If you change 1500 to 15 you will see that you don't get this problem any more. However the data point that was selected is still selected after the chart is destroyed and created again. I would have thought that the point would not be selected since the chart was destroyed. How is the data point remembering that it was selected?

Upvotes: 0

Views: 6148

Answers (1)

Sebastian Bochan
Sebastian Bochan

Reputation: 37578

The issue is caused by keeping reference to "old" data array. During chart initialisation, you set the reference to data array, which is modified. So when you destroy chart, reference still exists. Use the copy of data ($.extend([],data)) in Highcharts objects.

  series: [{
    data: $.extend([], data)
  }],

Example:

Upvotes: 3

Related Questions