Reputation: 366
following situation: Dygraph expects data in following format
var data = [[0,1,2],[1,2,3]]
which simplifies:
[[x0, y10, y20], [x1, y11, y21], ... , [xn, y1n, y2n]]
Now deleting a series - a line in the graph - means deleting every ykn from the data array.
var firstSeriesDeleted = [[0,2], [1,3]]
Question is: Is there an optimized way to delete out the series with a complexity less than o(n) ? I'm using lodash framework and basic JavaScript.
Upvotes: 0
Views: 190
Reputation: 16945
If you're content to simply hide the series, you can use the setVisibility
method.
Redrawing the chart is going to require more time than modifying your data array, so don't worry too much about the time complexity of manipulating your data.
Upvotes: 1