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
Is your feature request related to a problem? Please describe.
I have a plot with lots of traces (a few hundred) defined in non-server Bokeh, but only a few traces displayed at any given time based on some CDSView settings the user may select. I'd like to have a legend for the plot, but due to the number of underlying traces the legend becomes unusably large because legend entries for all of the filtered-out traces are still visible.
Describe the solution you'd like
I can think of two possible solutions:
The first would be to simply add a .visible property to LegendItems that could be toggled via CustomJS to disable rendering. The second would be to have some mechanic whereby legend items may auto-hide if no points from the given GlyphRenderer are visible (either due to hiding, filtering, or simply not being in the visible plot area).
Describe alternatives you've considered
I tried creating pre-computing each possible legend configuration and adding/removing legend items (or even whole legends) via CustomJS, but this gave me a lot of cryptic error messages and based on this other conversation, CustomJS that could modify the calculation graph is frowned upon: https://discourse.bokeh.org/t/updating-legend-when-using-bokeh-js/3947/3
The text was updated successfully, but these errors were encountered:
One thing people have asked for is to automatically hide legend items if associated glyphs are not visible. This seems reasonable mostly, but there are some UX interactions to consider. Specifically if "interactive legend" hiding is turned on and a user clicked a legend item, then the glyph is made invisible. If that in turn hides the legend item then there would be no way to reverse the operation to make things visible again.