Skip to main content

PlotMarks

Trait PlotMarks 

pub trait PlotMarks: 'static {
    type Hover: Clone + PartialEq;
    type Activated: Clone;

    const NAME: &'static str;
    const LABEL: &'static str;
Show 21 methods // Required methods fn frame(&self) -> &PlotFrame<Self::Hover>; fn frame_mut(&mut self) -> &mut PlotFrame<Self::Hover>; fn hit(&self, point: Point) -> Option<Self::Hover>; fn keyboard_items(&self) -> Vec<Self::Hover>; fn anchor(&self, item: &Self::Hover) -> Option<Point>; fn activation(&self, item: &Self::Hover) -> Option<Self::Activated>; fn items(&self) -> Vec<PlotItem<Self::Activated>>; fn paint( &mut self, scene: &mut Scene, transform: Affine, tr: &mut TextRenderer, theme: &Theme, ); // Provided methods fn label(&self) -> &'static str { ... } fn series(&self) -> Vec<(&str, &str)> { ... } fn legend_interactive(&self) -> bool { ... } fn toggles(&self) -> Option<&SeriesToggles> { ... } fn toggles_mut(&mut self) -> Option<&mut SeriesToggles> { ... } fn series_of(&self, _item: &Self::Hover) -> Option<&str> { ... } fn is_animating(&self) -> bool { ... } fn layout_height(&self) -> Option<f32> { ... } fn natural_height( &self, _tr: &mut TextRenderer, _theme: &Theme, _width: f64, ) -> f64 { ... } fn event(&mut self, _event: &WindowEvent, _ctx: &mut EventCtx<'_>) -> bool { ... } fn wants_pointer_capture(&self) -> bool { ... } fn visible_changed(&mut self) { ... } fn follow_keyboard_anchor(&mut self) { ... }
}
Expand description

What a chart kind supplies to Plot.

Required Associated Constants§

const NAME: &'static str

The widget name.

const LABEL: &'static str

The accessible name of an untitled chart.

Required Associated Types§

type Hover: Clone + PartialEq

The inspected mark.

type Activated: Clone

What activating a mark reports through Plot::take_activated.

Required Methods§

fn frame(&self) -> &PlotFrame<Self::Hover>

fn frame_mut(&mut self) -> &mut PlotFrame<Self::Hover>

fn hit(&self, point: Point) -> Option<Self::Hover>

The mark under point.

fn keyboard_items(&self) -> Vec<Self::Hover>

The marks the keyboard steps through, in order.

fn anchor(&self, item: &Self::Hover) -> Option<Point>

Where inspecting item puts the pointer; None leaves it.

fn activation(&self, item: &Self::Hover) -> Option<Self::Activated>

What activating item reports; None when it is not activatable.

fn items(&self) -> Vec<PlotItem<Self::Activated>>

Every mark the accessibility tree lists.

fn paint( &mut self, scene: &mut Scene, transform: Affine, tr: &mut TextRenderer, theme: &Theme, )

Paints the marks. Call Self::follow_keyboard_anchor once the geometry is current and before painting the inspector.

Provided Methods§

fn label(&self) -> &'static str

The accessible name, which can depend on the marks’ style.

fn series(&self) -> Vec<(&str, &str)>

The series that can be shown and hidden, as (id, name).

fn legend_interactive(&self) -> bool

Whether clicking a legend entry shows or hides its series.

fn toggles(&self) -> Option<&SeriesToggles>

fn toggles_mut(&mut self) -> Option<&mut SeriesToggles>

fn series_of(&self, _item: &Self::Hover) -> Option<&str>

The series item belongs to, if any.

fn is_animating(&self) -> bool

fn layout_height(&self) -> Option<f32>

The height the chart lays out at; None fills the parent.

fn natural_height( &self, _tr: &mut TextRenderer, _theme: &Theme, _width: f64, ) -> f64

The height a filling chart wants at width when the parent leaves it open.

fn event(&mut self, _event: &WindowEvent, _ctx: &mut EventCtx<'_>) -> bool

Takes the events the shell’s own inspection cannot drive — zoom, pan, brush, focus loss — before the shell inspects. Whether the event was consumed.

fn wants_pointer_capture(&self) -> bool

Whether a gesture is in flight and must keep receiving the pointer.

fn visible_changed(&mut self)

A series was shown or hidden: marks that cache their domain or their geometry drop it.

fn follow_keyboard_anchor(&mut self)

Keeps the pointer on a mark the keyboard chose while the geometry changes under it, so its inspector shows there.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

§

impl PlotMarks for CandlestickMarks

§

const NAME: &'static str = "CandlestickChart"

§

const LABEL: &'static str = "Candlestick chart"

§

type Hover = usize

§

type Activated = String

§

impl PlotMarks for CartesianMarks

§

const NAME: &'static str = "CartesianPlot"

§

const LABEL: &'static str = "Plot"

§

type Hover = CartesianHover

§

type Activated = CartesianActivation

§

impl PlotMarks for CategoryMarks

§

const NAME: &'static str = "CategoryChart"

§

const LABEL: &'static str = "Category chart"

§

type Hover = (usize, usize)

§

type Activated = (String, String)

§

impl PlotMarks for ChordMarks

§

const NAME: &'static str = "ChordChart"

§

const LABEL: &'static str = "Chord diagram"

§

type Hover = GraphSelection

§

type Activated = GraphSelection

§

impl PlotMarks for DistributionMarks

§

const NAME: &'static str = "DistributionChart"

§

const LABEL: &'static str = "Distribution chart"

§

type Hover = usize

§

type Activated = String

§

impl PlotMarks for FunnelMarks

§

const NAME: &'static str = "FunnelChart"

§

const LABEL: &'static str = "Funnel chart"

§

type Hover = usize

§

type Activated = String

§

impl PlotMarks for HeatmapMarks

§

const NAME: &'static str = "Heatmap"

§

const LABEL: &'static str = "Heatmap"

§

type Hover = usize

§

type Activated = String

§

impl PlotMarks for PieMarks

§

const NAME: &'static str = "PieChart"

§

const LABEL: &'static str = "Chart"

§

type Hover = usize

§

type Activated = String

§

impl PlotMarks for PolarAreaMarks

§

const NAME: &'static str = "PolarAreaChart"

§

const LABEL: &'static str = "Polar area chart"

§

type Hover = String

§

type Activated = String

§

impl PlotMarks for RadarMarks

§

const NAME: &'static str = "RadarChart"

§

const LABEL: &'static str = "Radar chart"

§

type Hover = Hovered

§

type Activated = (String, String)

§

impl PlotMarks for RangeMarks

§

const NAME: &'static str = "RangeChart"

§

const LABEL: &'static str = "Range chart"

§

type Hover = String

§

type Activated = String

§

impl PlotMarks for SankeyMarks

§

const NAME: &'static str = "SankeyChart"

§

const LABEL: &'static str = "Sankey diagram"

§

type Hover = Hit

§

type Activated = GraphSelection

§

impl PlotMarks for SunburstMarks

§

const NAME: &'static str = "SunburstChart"

§

const LABEL: &'static str = "Sunburst chart"

§

type Hover = String

§

type Activated = String

§

impl PlotMarks for TreemapMarks

§

const NAME: &'static str = "Treemap"

§

const LABEL: &'static str = "Treemap"

§

type Hover = usize

§

type Activated = String