pub trait PlotItem {
// Required methods
fn shapes(
&self,
ui: &Ui,
transform: &PlotTransform,
shapes: &mut Vec<Shape>,
);
fn initialize(&mut self, x_range: RangeInclusive<f64>);
fn name(&self) -> &str;
fn color(&self) -> Color32;
fn highlight(&mut self);
fn highlighted(&self) -> bool;
fn geometry(&self) -> PlotGeometry<'_>;
fn bounds(&self) -> PlotBounds;
fn id(&self) -> Option<Id>;
// Provided methods
fn find_closest(
&self,
point: Pos2,
transform: &PlotTransform,
) -> Option<ClosestElem> { ... }
fn on_hover(
&self,
elem: ClosestElem,
shapes: &mut Vec<Shape>,
cursors: &mut Vec<Cursor>,
plot: &PlotConfig<'_>,
label_formatter: &Option<Box<dyn Fn(&str, &PlotPoint) -> String>>,
) { ... }
}Expand description
Trait shared by things that can be drawn in the plot.
Required Methods§
fn shapes(&self, ui: &Ui, transform: &PlotTransform, shapes: &mut Vec<Shape>)
Sourcefn initialize(&mut self, x_range: RangeInclusive<f64>)
fn initialize(&mut self, x_range: RangeInclusive<f64>)
For plot-items which are generated based on x values (plotting functions).