Trait PlotItem

Source
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§

Source

fn shapes(&self, ui: &Ui, transform: &PlotTransform, shapes: &mut Vec<Shape>)

Source

fn initialize(&mut self, x_range: RangeInclusive<f64>)

For plot-items which are generated based on x values (plotting functions).

Source

fn name(&self) -> &str

Source

fn color(&self) -> Color32

Source

fn highlight(&mut self)

Source

fn highlighted(&self) -> bool

Source

fn geometry(&self) -> PlotGeometry<'_>

Source

fn bounds(&self) -> PlotBounds

Source

fn id(&self) -> Option<Id>

Provided Methods§

Source

fn find_closest( &self, point: Pos2, transform: &PlotTransform, ) -> Option<ClosestElem>

Source

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>>, )

Implementors§