8000 [FEATURE]Make LegendItems Hideable · Issue #9261 · bokeh/bokeh · GitHub
[go: up one dir, main page]

8000
Skip to content

[FEATURE]Make LegendItems Hideable #9261

@DataFramed

Description

@DataFramed

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

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0