Replies: 1 comment
-
I don't understand why this was moved out of the bug category |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description
I was building a chart of time series data with 4 point annotations, marking the min and max of my two data series, and then using clearAnnotations() before updating my chart data and re-adding 4 new annotations... but then I started ending up with old annotations getting left behind and having extra each update.
After looking into the issue I would blame the clearAnnotations() function. The array is being mutated while map tries to iterate over it. If the goal is to remove these items from the, array, it is leaving some behind.
// annotations added externally should be cleared out too w.globals.memory.methodsToExec.map(function (m, i) { if (m.label === 'addText' || m.label === 'addAnnotation') { w.globals.memory.methodsToExec.splice(i, 1); } });
I have tested on my own by replacing it with a filter and it seems to have fixed the problem
// annotations added externally should be cleared out too w.globals.memory.methodsToExec = w.globals.memory.methodsToExec.filter(function (m) { return !(m.label === 'addText' || m.label === 'addAnnotation'); });
Beta Was this translation helpful? Give feedback.
All reactions