Struct Chart

Source
pub struct Chart<'a> { /* private fields */ }
Expand description

Chart represents a single document with one or more views, axes and a title. It will also contain grid and legend in the future.

Implementations§

Source§

impl<'a> Chart<'a>

Source

pub fn new() -> Self

Create a new chart.

Source

pub fn view_width(&self) -> i32

Get chart width that can be used for views.

Source

pub fn view_height(&self) -> i32

Get chart height that can be used for views.

Source

pub fn set_margin_top(self, margin_top: i32) -> Self

Set chart top margin.

Source

pub fn set_margin_bottom(self, margin_bottom: i32) -> Self

Set chart bottom margin.

Source

pub fn set_margin_left(self, margin_left: i32) -> Self

Set chart left margin.

Source

pub fn set_margin_right(self, margin_right: i32) -> Self

Set chart right margin.

Source

pub fn set_width(self, width: i32) -> Self

Set chart width.

Source

pub fn set_height(self, height: i32) -> Self

Set chart height.

Source

pub fn set_axis_top_band(self, scale: BandScale) -> Self

Set BandScale for top axis.

Source

pub fn set_axis_top_linear(self, scale: LinearScale) -> Self

Set LinearScale for top axis.

Source

pub fn set_axis_bottom_band(self, scale: BandScale) -> Self

Set BandScale for bottom axis.

Source

pub fn set_axis_bottom_linear(self, scale: LinearScale) -> Self

Set LinearScale for bottom axis.

Source

pub fn set_axis_left_band(self, scale: BandScale) -> Self

Set BandScale for left axis.

Source

pub fn set_axis_left_linear(self, scale: LinearScale) -> Self

Set LinearScale for left axis.

Source

pub fn set_axis_right_band(self, scale: BandScale) -> Self

Set BandScale for right axis.

Source

pub fn set_axis_right_linear(self, scale: LinearScale) -> Self

Set LinearScale for right axis.

Source

pub fn set_axis_top_label(self, label: &str) -> Self

Set label for top axis.

Source

pub fn set_axis_bottom_label(self, label: &str) -> Self

Set label for bottom axis.

Source

pub fn set_axis_left_label(self, label: &str) -> Self

Set label for left axis.

Source

pub fn set_axis_right_label(self, label: &str) -> Self

Set label for right axis.

Source

pub fn set_title(self, title: &str) -> Self

Set chart title.

Source

pub fn add_view(self, view: &'a dyn View) -> Self

Add a view to chart.

Source

pub fn set_views(self, views: Vec<&'a dyn View>) -> Self

Set chart views.

Source

pub fn to_svg(&self) -> Document

Get chart SVG representation.

Source

pub fn save<P: AsRef<Path>>(&self, path: P) -> Result<(), Error>

Save chart to SVG file at the specified path.

Trait Implementations§

Source§

impl<'a> Default for Chart<'a>

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<'a> Freeze for Chart<'a>

§

impl<'a> !RefUnwindSafe for Chart<'a>

§

impl<'a> !Send for Chart<'a>

§

impl<'a> !Sync for Chart<'a>

§

impl<'a> Unpin for Chart<'a>

§

impl<'a> !UnwindSafe for Chart<'a>

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