Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions egui_plot/src/items/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1304,7 +1304,7 @@ pub struct BarChart {
base: PlotItemBase,

pub(super) bars: Vec<Bar>,
pub(super) default_color: Color32,
default_color: Color32,

/// A custom element formatter
pub(super) element_formatter: Option<Box<dyn Fn(&Bar, &BarChart) -> String>>,
Expand Down Expand Up @@ -1463,8 +1463,7 @@ pub struct BoxPlot {
base: PlotItemBase,

pub(super) boxes: Vec<BoxElem>,
pub(super) default_color: Color32,
pub(super) name: String,
default_color: Color32,

/// A custom element formatter
pub(super) element_formatter: Option<Box<dyn Fn(&BoxElem, &BoxPlot) -> String>>,
Expand All @@ -1477,7 +1476,6 @@ impl BoxPlot {
base: PlotItemBase::new(name.into()),
boxes,
default_color: Color32::TRANSPARENT,
name: String::new(),
element_formatter: None,
}
}
Expand Down Expand Up @@ -1543,10 +1541,6 @@ impl PlotItem for BoxPlot {
// nothing to do
}

fn name(&self) -> &str {
self.name.as_str()
}

fn color(&self) -> Color32 {
self.default_color
}
Expand Down
4 changes: 2 additions & 2 deletions egui_plot/src/plot_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ impl<'a> PlotUi<'a> {
}

// Give the elements an automatic color if no color has been assigned.
if box_plot.default_color == Color32::TRANSPARENT {
if PlotItem::color(&box_plot) == Color32::TRANSPARENT {
box_plot = box_plot.color(self.auto_color());
}
self.items.push(Box::new(box_plot));
Expand All @@ -251,7 +251,7 @@ impl<'a> PlotUi<'a> {
}

// Give the elements an automatic color if no color has been assigned.
if chart.default_color == Color32::TRANSPARENT {
if PlotItem::color(&chart) == Color32::TRANSPARENT {
chart = chart.color(self.auto_color());
}
self.items.push(Box::new(chart));
Expand Down
Loading