pub trait PlotItem {
Show 14 methods
// Required methods
fn shapes(
&self,
ui: &Ui,
transform: &PlotTransform,
shapes: &mut Vec<Shape>,
);
fn initialize(&mut self, x_range: RangeInclusive<f64>);
fn color(&self) -> Color32;
fn geometry(&self) -> PlotGeometry<'_>;
fn bounds(&self) -> PlotBounds;
fn base(&self) -> &PlotItemBase;
fn base_mut(&mut self) -> &mut PlotItemBase;
// Provided methods
fn name(&self) -> &str { ... }
fn highlight(&mut self) { ... }
fn highlighted(&self) -> bool { ... }
fn allow_hover(&self) -> bool { ... }
fn id(&self) -> Id { ... }
fn find_closest(
&self,
point: Pos2,
transform: &PlotTransform,
) -> Option<ClosestElem> { ... }
fn on_hover(
&self,
plot_area_response: &Response,
elem: ClosestElem,
shapes: &mut Vec<Shape>,
cursors: &mut Vec<Cursor>,
plot: &PlotConfig<'_>,
label_formatter: &Option<LabelFormatter<'_>>,
) { ... }
}Expand description
Trait shared by things that can be drawn in the plot.
Required Methods§
Sourcefn shapes(&self, ui: &Ui, transform: &PlotTransform, shapes: &mut Vec<Shape>)
fn shapes(&self, ui: &Ui, transform: &PlotTransform, shapes: &mut Vec<Shape>)
Generate shapes to be drawn in the plot.
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).
Sourcefn geometry(&self) -> PlotGeometry<'_>
fn geometry(&self) -> PlotGeometry<'_>
Returns the geometry of the plot item.
Sourcefn bounds(&self) -> PlotBounds
fn bounds(&self) -> PlotBounds
Returns the bounds of the plot item.
Sourcefn base(&self) -> &PlotItemBase
fn base(&self) -> &PlotItemBase
Returns a reference to the base data of the plot item.
Sourcefn base_mut(&mut self) -> &mut PlotItemBase
fn base_mut(&mut self) -> &mut PlotItemBase
Returns a mutable reference to the base data of the plot item.
Provided Methods§
Sourcefn highlighted(&self) -> bool
fn highlighted(&self) -> bool
Returns whether the plot item is highlighted.
Sourcefn allow_hover(&self) -> bool
fn allow_hover(&self) -> bool
Can the user hover this item?
Sourcefn find_closest(
&self,
point: Pos2,
transform: &PlotTransform,
) -> Option<ClosestElem>
fn find_closest( &self, point: Pos2, transform: &PlotTransform, ) -> Option<ClosestElem>
Find the closest element in the plot item to the given point.
Sourcefn on_hover(
&self,
plot_area_response: &Response,
elem: ClosestElem,
shapes: &mut Vec<Shape>,
cursors: &mut Vec<Cursor>,
plot: &PlotConfig<'_>,
label_formatter: &Option<LabelFormatter<'_>>,
)
fn on_hover( &self, plot_area_response: &Response, elem: ClosestElem, shapes: &mut Vec<Shape>, cursors: &mut Vec<Cursor>, plot: &PlotConfig<'_>, label_formatter: &Option<LabelFormatter<'_>>, )
Handle hover events for the plot item.