Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <emilk/egui#3533>. --------- Co-authored-by: Emil Ernerfeldt <[email protected]>
- Loading branch information