Legend: Allow hiding an element from the legend, while leacving it drawn

Open
#228 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
rust

Research direction

Start by inspecting the legend API and the existing hidden_items behavior in the egui_plot codebase. The change is done when a plot item or span can remain drawn while being omitted from the legend, with behavior clearly defined by the API.

Written by the indexing model from the issue text.

Description

Is your feature request related to a problem? Please describe.
With the recent addition of spans (very happy with them by the way). There's a fair amount of information that can be hinted to the user directly with the label on the span. When there are many spans used this ends up filling the legend with excess information that is already directly duplicated on screen with the spans label.

As a concrete example, I'm using it to indicate vehicle modes here, but the information clutters the legend, and makes it obscure far more then it needs to.

Image

Describe the solution you'd like
I'd like to look at extending the legend API to have something similar to hidden_items, but instead of toggling visibility on the plot I want to use it to control if the item is added to the legend at all.

Describe alternatives you've considered
A different option would be to make it so that spans, or plot items could explicitly have their visibility in the legend toggled on the item, but it didn't seem like it necessarily fit well with the rest.

Additional context
I'm actually happy to take a stab at getting this done, just wanted to look at the API first.

Dominant language
Rust
Stars
467
Forks
107
Avg merge
15m
Merged PRs (30d)
3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from emilk/egui_plot

All issues in emilk/egui_plot

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.