Skip to main content

PlotStyle

Struct PlotStyle 

Source
#[non_exhaustive]
pub struct PlotStyle {
Show 55 fields pub kind: ChartKind, pub colors: Vec<Color>, pub item_colors: Vec<Color>, pub ink: Color, pub muted: Color, pub grid: Color, pub surface: Color, pub track: Color, pub size: f32, pub curve: Curve, pub stack: Stack, pub gradient: bool, pub fill_opacity: f32, pub horizontal: bool, pub reversed: bool, pub min_bar: f32, pub labels_at_zero: bool, pub bar_radius: f32, pub max_bar: f32, pub negative: Option<Color>, pub rising: Color, pub falling: Color, pub active: Option<usize>, pub dots: bool, pub value_labels: Option<LabelAt>, pub category_labels: Option<LabelAt>, pub format: Rc<dyn Fn(f64) -> String>, pub tick_format: Rc<dyn Fn(&str) -> String>, pub grid_lines: Grid, pub category_axis: bool, pub value_axis: bool, pub tight_scale: bool, pub separator: f32, pub slice_radii: Vec<f32>, pub label_guides: bool, pub hole: f32, pub concentric: bool, pub polar_grid: PolarGrid, pub polar_fill: bool, pub spokes: bool, pub rings: usize, pub lines_only: bool, pub radius_axis: bool, pub start_angle: f32, pub sweep: f32, pub tracks: bool, pub center: Option<(String, String)>, pub rules_apart: bool, pub bars_apart: bool, pub grid_dashed: bool, pub value_ticks: usize, pub grid_columns: Option<usize>, pub ends_aligned: bool, pub references: Vec<Reference>, pub domain: Option<(f64, f64)>,
}
Expand description

The look of a chart. Start from PlotStyle::new and change what differs.

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.
§kind: ChartKind

The kind of chart.

§colors: Vec<Color>

Series colors, or slice and ring colors, repeated as needed.

§item_colors: Vec<Color>

Colors per category, over the colors of the series.

§ink: Color

Text that matters, such as the number in the center.

§muted: Color

Text around the data.

§grid: Color

Gridlines.

§surface: Color

What is behind the chart. Slices are kept apart by a real gap, so it no longer paints anything.

§track: Color

The track behind a ring.

§size: f32

The font size of the text around the data.

§curve: Curve

How lines go from point to point.

§stack: Stack

How series share a category.

§gradient: bool

Fills areas from strong at the top to faint at the bottom, and bars from strong at the tip to fainter at the base.

§fill_opacity: f32

How solid an area or a radar polygon is.

§horizontal: bool

Bars lie down, with their categories on the left.

§reversed: bool

The value axis runs the other way: bars hang from the top, or if they lie down they grow to the left from the right.

§min_bar: f32

The shortest a bar with a value gets, however small the value is.

§labels_at_zero: bool

The categories of bars sit on the line of zero, on its other side from the bar, instead of along the edge of the chart.

§bar_radius: f32

The corners of a bar.

§max_bar: f32

The widest a bar gets.

§negative: Option<Color>

The color of a bar below zero.

§rising: Color

The color of a candle that closed at or above where it opened.

§falling: Color

The color of a candle that closed below where it opened.

§active: Option<usize>

The category standing out: a slice comes forward, a bar gets an outline.

§dots: bool

Draws a dot at each point of a line or a radar.

§value_labels: Option<LabelAt>

Where the values are written, if at all.

§category_labels: Option<LabelAt>

Where the categories are written beside the data, if at all.

§format: Rc<dyn Fn(f64) -> String>

How numbers are written.

§tick_format: Rc<dyn Fn(&str) -> String>

How categories are written on the axis.

§grid_lines: Grid

Gridlines of a chart with axes.

§category_axis: bool

Writes the categories along the axis.

§value_axis: bool

Writes numbers along the axis.

§tight_scale: bool

The scale fits the values instead of starting from zero.

§separator: f32

The gap between slices; zero for none.

§slice_radii: Vec<f32>

How far each slice reaches, in order, as a share of the room from the hole to the edge. One with no number here reaches the edge.

§label_guides: bool

Labels outside a round chart sit in a column on each side, none over another, each joined to its slice by a line with an elbow.

§hole: f32

The hole of a doughnut or of rings, as a share of the radius.

§concentric: bool

One ring per series, instead of only the first series.

§polar_grid: PolarGrid

The grid of a radar or radial chart.

§polar_fill: bool

Fills the grid of a radar chart with the first color.

§spokes: bool

Lines from the center of a radar chart to each category.

§rings: usize

How many rings the grid of a radar chart has.

§lines_only: bool

Radar polygons with no fill.

§radius_axis: bool

Writes numbers along the radius of a radar chart.

§start_angle: f32

Where rings start, in degrees clockwise from the top.

§sweep: f32

How many degrees the largest ring covers.

§tracks: bool

Draws the track behind each ring.

§center: Option<(String, String)>

A big number and a caption in the middle of a doughnut or of rings.

§rules_apart: bool

Leaves gridlines out of Plot::layers and says where they go in Plot::rules, for a screen that can line them up with its pixels and fade the data without them. Pages leave this off and get everything in the layers.

§bars_apart: bool

Leaves bars out of Plot::layers and says where they go in Plot::bars, for a screen that draws them itself at no cost when the size changes. The gridlines they cross are left out from behind them, so that a bar that fades shows no line through it.

§grid_dashed: bool

Gridlines in dashes.

§value_ticks: usize

About how many steps the value axis has; round numbers decide how many exactly.

§grid_columns: Option<usize>

Upright gridlines evenly spread into this many columns, instead of at each category or number, and whatever Self::grid_lines says of the others.

§ends_aligned: bool

The first category along the axis starts at its point and the last one ends at its point, so that they line up with the ends of a line or an area.

§references: Vec<Reference>

Lines across the data at values that matter, such as a target.

§domain: Option<(f64, f64)>

The value axis goes exactly from the first number to the second, and what is past them is cut off, instead of the axis fitting the values.

Implementations§

Source§

impl PlotStyle

Source

pub fn new(kind: ChartKind) -> Self

The look most charts of this kind want.

Trait Implementations§

Source§

impl Clone for PlotStyle

Source§

fn clone(&self) -> PlotStyle

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

Auto Trait Implementations§

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.