I'm having difficulties removing an event listener, since removeEventListener only works for non-anynomous functions I need to make a named function. The problem is I can't figure out how to pass the chart variable to the toggleLabels function without calling the function while I do it..
I tried looking at this question but no answer worked.
Is this possible?
var chart = {}; // Big object
labelToggle.addEventListener('click', toggleLabels);
function toggleLabels(chart) {
scope.graph.isLabelsVisible = chart.isLabelsVisible = !chart.isLabelsVisible;
for (i = 0; i < length; i++) {
chart.series[i].isLabelsVisible = !chart.series[i].isLabelsVisible;
chart.series[i].hide();
chart.series[i].show();
};
};