egui/crates/egui_plot/src
jayzhudev e13cc69d76
Add a public API for overriding plot legend traces' visibilities (#3534)
Added a public API in `egui_plot -> legend` to allow `hidden_items` to
be overridden in the plot legend widget. This allows convenient control
of traces' visibilities the selection of traces from the application
code.

### Example
```rust
    let legend_config = if plot_selection_changed {
        let hidden_items = match plot_selection {
            PlotSelection::SelectAll => Vec::new(),
            PlotSelection::DeselectAll => all_trace_names,
        };

        Legend::default()
            .position(Corner::RightTop)
            .hidden_items(hidden_items) // Overrides `hidden_items`
    } else {
        Legend::default().position(Corner::RightTop)
    };

    Plot::new(id)
        .legend(legend_config)
        .show(ui, draw_plot);
```

Closes <https://github.com/emilk/egui/issues/3533>.

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2024-01-06 22:35:54 +01:00
..
items Replace a special `Color32::PLACEHOLDER` with widget fallback color (#3727) 2023-12-22 15:09:10 +01:00
axis.rs Replace a special `Color32::PLACEHOLDER` with widget fallback color (#3727) 2023-12-22 15:09:10 +01:00
legend.rs Add a public API for overriding plot legend traces' visibilities (#3534) 2024-01-06 22:35:54 +01:00
lib.rs Plot custom zoom (#2714) 2024-01-06 22:34:42 +01:00
memory.rs Break out plotting to own crate `egui_plot` (#3282) 2023-08-27 17:22:49 +02:00
transform.rs Plot custom zoom (#2714) 2024-01-06 22:34:42 +01:00