Skip to main content

Plot

Struct Plot 

Source
#[non_exhaustive]
pub struct Plot {
Show 15 fields pub layers: Vec<Layer>, pub labels: Vec<ChartLabel>, pub spots: Vec<Spot>, pub marks: Vec<Mark>, pub sectors: Vec<Sector>, pub area: Rect, pub bars: Vec<Bar>, pub candles: Vec<Candle>, pub rules: Vec<Rule>, pub top_rules: Vec<Rule>, pub backdrop: usize, pub notes: Vec<usize>, pub data_labels: Vec<usize>, pub baseline: Option<f32>, pub uncut_rules: Vec<Rule>,
}
Expand description

A chart laid out.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§layers: Vec<Layer>

What to draw, back to front.

§labels: Vec<ChartLabel>

The text, to draw over the layers.

§spots: Vec<Spot>

The categories of a chart with axes.

§marks: Vec<Mark>

Where each value landed.

§sectors: Vec<Sector>

The slices of a round chart.

§area: Rect

Where the data is, inside the axes.

§bars: Vec<Bar>

The bars of a bar chart.

§candles: Vec<Candle>

The candles of a ChartKind::Candlestick, when PlotStyle::bars_apart leaves them out of the layers.

§rules: Vec<Rule>

Gridlines, behind the layers, when PlotStyle::rules_apart asks for them.

§top_rules: Vec<Rule>

Lines of reference, over the layers, when PlotStyle::rules_apart asks for them.

§backdrop: usize

How many of the first layers are the backdrop the data is drawn over, such as the rings and spokes of a radar, which stay put while the data draws in.

§notes: Vec<usize>

The layers that only point at the data, such as the guide from a slice to its label: they come in with the labels, once the data is nearly whole.

§data_labels: Vec<usize>

The labels that belong to the data, such as a bar’s value, and not to an axis.

§baseline: Option<f32>

Where the value axis has its zero, inside the area: what bars grow out of.

§uncut_rules: Vec<Rule>

The gridlines before Self::rules stopped at the bars, for bars of another length, such as while they grow, to cut them again with rules_around_bars.

Implementations§

Source§

impl Plot

Source

pub fn hit(&self, point: Point) -> Option<Hit>

What is under point, in the coordinates the chart was laid out in.

Source

pub fn over_grown_slice(&self, point: Point, index: usize, by: f32) -> bool

Whether point is over the slice of this category, once it has grown by by.

Source

pub fn categories(&self) -> usize

Whether this category has any place on the chart, and how many there are.

Source

pub fn anchor_of(&self, index: usize) -> Option<Point>

Where a tooltip about a category should point at.

Trait Implementations§

Source§

impl Clone for Plot

Source§

fn clone(&self) -> Plot

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Plot

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Plot

Source§

fn default() -> Plot

Returns the “default value” for a type. Read more
Source§

impl From<ChartDrawing> for Plot

Source§

fn from(drawing: ChartDrawing) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Plot

Source§

fn eq(&self, other: &Plot) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Plot

Auto Trait Implementations§

§

impl Freeze for Plot

§

impl RefUnwindSafe for Plot

§

impl Send for Plot

§

impl Sync for Plot

§

impl Unpin for Plot

§

impl UnsafeUnpin for Plot

§

impl UnwindSafe for Plot

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.