Struct LineStyle

Source
pub struct LineStyle {
    pub colour: Option<String>,
    pub width: Option<f32>,
    pub linejoin: Option<LineJoin>,
}

Fields§

§colour: Option<String>§width: Option<f32>§linejoin: Option<LineJoin>

Implementations§

Source§

impl LineStyle

Source

pub fn new() -> Self

Examples found in repository?
examples/line_svg.rs (line 8)
6fn main() {
7    let l1 = Plot::new(vec![(0., 1.), (2., 1.5), (3., 1.2), (4., 1.1)]).line_style(
8        LineStyle::new()
9            .colour("burlywood")
10            .linejoin(LineJoin::Round),
11    );
12    let v = ContinuousView::new().add(l1);
13    Page::single(&v).save("line.svg").expect("saving svg");
14}
More examples
Hide additional examples
examples/with_grid.rs (line 17)
12fn render_line_chart<S>(filename: S)
13where
14    S: AsRef<str>,
15{
16    let l1 = Plot::new(vec![(0., 1.), (2., 1.5), (3., 1.2), (4., 1.1)])
17        .line_style(LineStyle::new().colour("burlywood"));
18    let mut v = ContinuousView::new().add(l1);
19    v.add_grid(Grid::new(3, 8));
20    Page::single(&v)
21        .save(filename.as_ref())
22        .expect("saving svg");
23}
examples/line_and_point_svg.rs (line 9)
6fn main() {
7    let l1 = Plot::new(vec![(0., 1.), (2., 1.5), (3., 1.2), (4., 1.1)])
8        .line_style(
9            LineStyle::new()
10                .colour("burlywood")
11                .linejoin(LineJoin::Round),
12        )
13        .point_style(PointStyle::new());
14
15    let v = ContinuousView::new().add(l1);
16    Page::single(&v)
17        .save("line_and_point.svg")
18        .expect("saving svg");
19}
examples/function_svg.rs (line 8)
6fn main() {
7    let f1 =
8        Plot::from_function(|x| x * 5., 0., 10.).line_style(LineStyle::new().colour("burlywood"));
9    let f2 = Plot::from_function(|x| x.powi(2), 0., 10.)
10        .line_style(LineStyle::new().colour("darkolivegreen").width(2.));
11    let f3 = Plot::from_function(|x| x.sqrt() * 20., 0., 10.)
12        .line_style(LineStyle::new().colour("brown").width(1.));
13
14    let v = ContinuousView::new().add(f1).add(f2).add(f3);
15
16    Page::single(&v).save("function.svg").expect("saving svg");
17}
Source

pub fn overlay(&mut self, other: &Self)

Source

pub fn colour<T>(self, value: T) -> Self
where T: Into<String>,

Examples found in repository?
examples/line_svg.rs (line 9)
6fn main() {
7    let l1 = Plot::new(vec![(0., 1.), (2., 1.5), (3., 1.2), (4., 1.1)]).line_style(
8        LineStyle::new()
9            .colour("burlywood")
10            .linejoin(LineJoin::Round),
11    );
12    let v = ContinuousView::new().add(l1);
13    Page::single(&v).save("line.svg").expect("saving svg");
14}
More examples
Hide additional examples
examples/with_grid.rs (line 17)
12fn render_line_chart<S>(filename: S)
13where
14    S: AsRef<str>,
15{
16    let l1 = Plot::new(vec![(0., 1.), (2., 1.5), (3., 1.2), (4., 1.1)])
17        .line_style(LineStyle::new().colour("burlywood"));
18    let mut v = ContinuousView::new().add(l1);
19    v.add_grid(Grid::new(3, 8));
20    Page::single(&v)
21        .save(filename.as_ref())
22        .expect("saving svg");
23}
examples/line_and_point_svg.rs (line 10)
6fn main() {
7    let l1 = Plot::new(vec![(0., 1.), (2., 1.5), (3., 1.2), (4., 1.1)])
8        .line_style(
9            LineStyle::new()
10                .colour("burlywood")
11                .linejoin(LineJoin::Round),
12        )
13        .point_style(PointStyle::new());
14
15    let v = ContinuousView::new().add(l1);
16    Page::single(&v)
17        .save("line_and_point.svg")
18        .expect("saving svg");
19}
examples/function_svg.rs (line 8)
6fn main() {
7    let f1 =
8        Plot::from_function(|x| x * 5., 0., 10.).line_style(LineStyle::new().colour("burlywood"));
9    let f2 = Plot::from_function(|x| x.powi(2), 0., 10.)
10        .line_style(LineStyle::new().colour("darkolivegreen").width(2.));
11    let f3 = Plot::from_function(|x| x.sqrt() * 20., 0., 10.)
12        .line_style(LineStyle::new().colour("brown").width(1.));
13
14    let v = ContinuousView::new().add(f1).add(f2).add(f3);
15
16    Page::single(&v).save("function.svg").expect("saving svg");
17}
Source

pub fn get_colour(&self) -> String

Source

pub fn width<T>(self, value: T) -> Self
where T: Into<f32>,

Examples found in repository?
examples/function_svg.rs (line 10)
6fn main() {
7    let f1 =
8        Plot::from_function(|x| x * 5., 0., 10.).line_style(LineStyle::new().colour("burlywood"));
9    let f2 = Plot::from_function(|x| x.powi(2), 0., 10.)
10        .line_style(LineStyle::new().colour("darkolivegreen").width(2.));
11    let f3 = Plot::from_function(|x| x.sqrt() * 20., 0., 10.)
12        .line_style(LineStyle::new().colour("brown").width(1.));
13
14    let v = ContinuousView::new().add(f1).add(f2).add(f3);
15
16    Page::single(&v).save("function.svg").expect("saving svg");
17}
Source

pub fn get_width(&self) -> f32

Source

pub fn linejoin<T>(self, value: T) -> Self
where T: Into<LineJoin>,

Examples found in repository?
examples/line_svg.rs (line 10)
6fn main() {
7    let l1 = Plot::new(vec![(0., 1.), (2., 1.5), (3., 1.2), (4., 1.1)]).line_style(
8        LineStyle::new()
9            .colour("burlywood")
10            .linejoin(LineJoin::Round),
11    );
12    let v = ContinuousView::new().add(l1);
13    Page::single(&v).save("line.svg").expect("saving svg");
14}
More examples
Hide additional examples
examples/line_and_point_svg.rs (line 11)
6fn main() {
7    let l1 = Plot::new(vec![(0., 1.), (2., 1.5), (3., 1.2), (4., 1.1)])
8        .line_style(
9            LineStyle::new()
10                .colour("burlywood")
11                .linejoin(LineJoin::Round),
12        )
13        .point_style(PointStyle::new());
14
15    let v = ContinuousView::new().add(l1);
16    Page::single(&v)
17        .save("line_and_point.svg")
18        .expect("saving svg");
19}
Source

pub fn get_linejoin(&self) -> LineJoin

Trait Implementations§

Source§

impl Clone for LineStyle

Source§

fn clone(&self) -> LineStyle

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for LineStyle

Source§

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

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

impl Default for LineStyle

Source§

fn default() -> LineStyle

Returns the “default value” for a type. 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.