-
Notifications
You must be signed in to change notification settings - Fork 91
Fix BoxPlot legend #97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
* *Replaced* `BoxPlot::color` with `BoxPlot::default_color`, as it was a name collision with `PlotItem::color`. * *Replaced* `BarChart::color` with `BarChart::default_color`, as it was a name collision with `PlotItem::color`. I know this is a breaking change without a deprication first, but i feel this is better than going for a deprication first. * Remove BoxPlots implementation of the `PlotItem::name()` function, and the `BoxPlot::name` field, as it was incomplete, and is also covered in `PlotItemBase` I also noticed there are missing snapshots for the barchart and boxplot, but i'd say thats worth its own PR.
|
Doesn't this fix imply that |
What i have done is remove the egui_plot/egui_plot/src/items/mod.rs Line 1415 in 46b496c
Technically, just removing the name field and the name implementation is enough to fix the legend issue, i have however decided to - while at it - rename the |
lucasmerlin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I've reverted the default_color change though, seems like the other plot items (e.g. Arrows, Points) also have this problem and if we fix this we should fix it for all. A seperate PR that fixes this for all items would be appreciated. I think a nicer name for the setter would maybe be with_color? And then keeping color() as the getter. On the other hand that would be inconsistent with the other setters, so maybe we should change them all to be with_*. Or change the getters on PlotItem to get_*? Seems like there is no nice solution 😅
Also note that you can still get the color via PlotItem::color(&my_item) (which is inconvenient but not super-bad)
color to default_color Fvg on discord noticed that BoxPlots were missing the legend.  Upon further investigation, either some merge was a bit icky, or something was missed when adding in `PlotItemBase`. To fix this i have * **Replaced** `BoxPlot::color` with `BoxPlot::default_color`, as it was a name collision with `PlotItem::color`. * **Replaced** `BarChart::color` with `BarChart::default_color`, as it was a name collision with `PlotItem::color`. I know this is a breaking change without a deprication first, but i feel this is better than ~~going for a deprication first~~ keeping that name collision in for longer. * Remove BoxPlots implementation of the `PlotItem::name()` function, and the `BoxPlot::name` field, as it was incomplete, and is also covered in `PlotItemBase` * Reduced the visibility of `BarChart::default_color` and `BoxPlot::default_color`, as it is only read, and only in `plot_ui.rs`, and that can be done via our newly not-name-colliding `PlotItem::color`. I also noticed there are missing snapshots for the (Charts.png is only the histogram, and only vertical). Barchart and boxplot are missing. But that is worth its own PR. In any case, with this, i get the expected legend back:  * [x] I have followed the instructions in the PR template * [x] I have run `check.sh` locally and it went through. --------- Co-authored-by: Lucas Meurer <lucasmeurer96@gmail.com> Co-authored-by: lucasmerlin <hi@lucasmerlin.me>
Fvg on discord noticed that BoxPlots were missing the legend.
Upon further investigation, either some merge was a bit icky, or something was missed when adding in
PlotItemBase.To fix this i have
BoxPlot::colorwithBoxPlot::default_color, as it was a name collision withPlotItem::color.BarChart::colorwithBarChart::default_color, as it was a name collision withPlotItem::color.I know this is a breaking change without a deprication first, but i feel this is better than
going for a deprication firstkeeping that name collision in for longer.PlotItem::name()function, and theBoxPlot::namefield, as it was incomplete, and is also covered inPlotItemBaseBarChart::default_colorandBoxPlot::default_color, as it is only read, and only inplot_ui.rs, and that can be done via our newly not-name-collidingPlotItem::color.I also noticed there are missing snapshots for the (Charts.png is only the histogram, and only vertical). Barchart and boxplot are missing. But that is worth its own PR.
In any case, with this, i get the expected legend back:
check.shlocally and it went through.