TimeChart icon indicating copy to clipboard operation
TimeChart copied to clipboard

How can I hide series depending on the Zoom scale ?

Open citron opened this issue 3 years ago • 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

citron avatar May 16 '22 05:05 citron

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.

huww98 avatar May 18 '22 03:05 huww98

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

huww98 avatar Sep 20 '22 15:09 huww98