Axis rescale on series hide..?

27 views
Skip to first unread message

Nick Thodey

unread,
Apr 24, 2020, 10:52:39 AM4/24/20
to Flot graphs
Hi all,

I have a flot line chart with a number of lines, where each data series can be hidden by clicking on its legend. I use getData(), update the lines.show to false for the series to hide it, and redraw the chart. This works great, however the X & Y axes remain scaled as if the "hidden" series is still there.

Just wondering if there's an "automatic" way to recalculate the axes when redrawing the chart to ignore hidden series data? Sometimes the remaining data is all squeezed into a small portion of the Y-axis for example and looks a bit odd.

I'm ok if the answer is that I need to manually set the min/max values, just don't want to do that if there's something I have overlooked that does this automagically :)

Cheers,

--Nick

Ced

unread,
May 2, 2020, 2:41:03 AM5/2/20
to Flot graphs
It's possible to do this by moving the hidden series to a hidden yaxis.
Here's an example.

Nick

unread,
May 4, 2020, 9:29:32 AM5/4/20
to Flot graphs
Thanks Ced, that is perfect. Much appreciated!

--Nick
Reply all
Reply to author
Forward
0 new messages