I get undefined for 'points' and "Uncaught TypeError: Cannot read property 'visible' of undefined" in the consoleconst points = Highcharts.charts.map((chart) => chart.series[inx])
Code: Select all
$('#legend .item').click(function() {
const inx = $(this).index()
const points = Highcharts.charts.map((chart) => chart.series[inx])
console.log(points);
points.forEach((point) => {
if (point.visible) point.setVisible(false)
else point.setVisible(true)
})
})
The fiddle with all the code I'm attempting to use can be found here https://jsfiddle.net/Willtron/75rb2gv3/25/
Note: I modified the legend code from another jsfiddle https://jsfiddle.net/1v4m5jce/ and am basically trying to tweak it to fit my circumstance. I'm not exactly adept at jquery or js. I've tried several different code variations over the past couple hours and I'm at a loss.