Trait egui_plot::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 allow_hover(&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: &LabelFormatter<'_>,
    ) { ... }
}
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 allow_hover(&self) -> bool

Can the user hover this item?

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: &LabelFormatter<'_>, )

Implementors§