You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Clicking a legend item it will toggle the series visibility on the screen, which is the proper operation.
But it does not actually update the visible property of the series, so calling isVisible() will still return true after hiding a series.
Simple workaround
Just adding the following legend item click listener will work around the problem:
Just stumbled across the same issue with charts 4.1.0. I was wondering if it was on purpose ... I solved the issue using a trick similar to yours ...
Fixing it in the code seems pretty easy (Chart.java in onSeriesHide & onSeriesShow). One needs to ensure that resolved Series is an instance of AbstractSeries and then call setVisible accordingly ... I'll submit a pull request for this...
Clicking a legend item it will toggle the series visibility on the screen, which is the proper operation.
But it does not actually update the visible property of the series, so calling isVisible() will still return true after hiding a series.
Simple workaround
Just adding the following legend item click listener will work around the problem:
chart.addLegendItemClickListener(event -> ((AbstractSeries) event.getSeries()).setVisible(!((AbstractSeries) event.getSeries()).isVisible()));
The text was updated successfully, but these errors were encountered: