Trying to console log the series data in my chart. Unsure why it's not working. JS fiddle is provided.
https://jsfiddle.net/3j9v06zr/
These are the 2 methods I am trying to use to log:
console.log(chart[0].series[0].data);
console.log(Highcharts.charts[0].series[0].data)
When I remove the first method:
console.log(chart[0].series[0].data);
things start to work, but I do not really receive the information I want. Does anyone have any ideas? I would just like to see "29.9" returned.
Cannot read properties of undefined (reading 'series')
Simply means that you're trying to access a method on an object that doesn't exist.
In other words, your error means that chart[0]
doesn't exist.
This is certainly because chart
is an object and not an array. The following code works:
console.log(chart.series[0].data);