huww98/TimeChart

How can I hide series depending on the Zoom scale ?

citron opened this issue · 2 comments

I plot 10 series but I want to hide some ( but not all ) depending on the zoom scale.
I have tried using dispose() then instantiate a new chart but the chart is not displayed even if I can find the right series in chart._options
Maybe there is a better alternative than dispose then redraw.
What would you please suggest ?
Thank you very much for TimeChart.js

I have tried using dispose() then instantiate a new chart but the chart is not displayed

This is the current limitation. The data array records whether the data have been uploaded to GPU, and this info would not be disposed with the chart instance. So you cannot use the same array with multiple chart instances currently. I plan to eliminate this limitation in the future.

Maybe there is a better alternative than dispose then redraw.

Ideally, I would like to support just removing series from chart.options.series, e.g. with .filter(...). I have not tested it, it probably would not work now.

Reviewing this issue. Can you just set the series to invisible instead of really remove it?

https://github.com/huww98/TimeChart#series-options We have a “visible” option