Skip to main content

BarOpts

Struct BarOpts 

Source
pub struct BarOpts { /* private fields */ }

Implementations§

Source§

impl BarOpts

Source

pub fn label(self, s: impl Into<String>) -> Self

Examples found in repository?
examples/gen_hero_svgs.rs (line 96)
88fn bar() -> String {
89    let cats = ["A", "B", "C", "D"];
90    Figure::new()
91        .size(PaperSize::A5Landscape)
92        .title("Test bench results")
93        .xlabel("specimen")
94        .ylabel("yield (MPa)")
95        .bar(&cats, &[320.0, 290.0, 410.0, 355.0], |b| {
96            b.label("trial 1").hatch(Hatch::Diagonal).group(0)
97        })
98        .bar(&cats, &[345.0, 305.0, 395.0, 380.0], |b| {
99            b.label("trial 2").hatch(Hatch::Crosshatch).group(1)
100        })
101        .legend_top_left()
102        .to_svg()
103}
More examples
Hide additional examples
examples/bar_grouped.rs (line 12)
3fn main() {
4    let cats = ["A", "B", "C", "D"];
5
6    let fig = Figure::new()
7        .size(PaperSize::A5Landscape)
8        .title("Test bench results")
9        .xlabel("specimen")
10        .ylabel("yield (MPa)")
11        .bar(&cats, &[320.0, 290.0, 410.0, 355.0], |b| {
12            b.label("trial 1").hatch(Hatch::Diagonal).group(0)
13        })
14        .bar(&cats, &[345.0, 305.0, 395.0, 380.0], |b| {
15            b.label("trial 2").hatch(Hatch::Crosshatch).group(1)
16        })
17        .legend_top_left();
18
19    std::fs::create_dir_all("out").expect("create out/");
20    std::fs::write("out/bar_grouped.svg", fig.to_svg()).expect("write svg");
21    println!("wrote out/bar_grouped.svg");
22}
Source

pub fn hatch(self, h: Hatch) -> Self

Examples found in repository?
examples/gen_hero_svgs.rs (line 96)
88fn bar() -> String {
89    let cats = ["A", "B", "C", "D"];
90    Figure::new()
91        .size(PaperSize::A5Landscape)
92        .title("Test bench results")
93        .xlabel("specimen")
94        .ylabel("yield (MPa)")
95        .bar(&cats, &[320.0, 290.0, 410.0, 355.0], |b| {
96            b.label("trial 1").hatch(Hatch::Diagonal).group(0)
97        })
98        .bar(&cats, &[345.0, 305.0, 395.0, 380.0], |b| {
99            b.label("trial 2").hatch(Hatch::Crosshatch).group(1)
100        })
101        .legend_top_left()
102        .to_svg()
103}
More examples
Hide additional examples
examples/bar_grouped.rs (line 12)
3fn main() {
4    let cats = ["A", "B", "C", "D"];
5
6    let fig = Figure::new()
7        .size(PaperSize::A5Landscape)
8        .title("Test bench results")
9        .xlabel("specimen")
10        .ylabel("yield (MPa)")
11        .bar(&cats, &[320.0, 290.0, 410.0, 355.0], |b| {
12            b.label("trial 1").hatch(Hatch::Diagonal).group(0)
13        })
14        .bar(&cats, &[345.0, 305.0, 395.0, 380.0], |b| {
15            b.label("trial 2").hatch(Hatch::Crosshatch).group(1)
16        })
17        .legend_top_left();
18
19    std::fs::create_dir_all("out").expect("create out/");
20    std::fs::write("out/bar_grouped.svg", fig.to_svg()).expect("write svg");
21    println!("wrote out/bar_grouped.svg");
22}
Source

pub fn group(self, g: u32) -> Self

Examples found in repository?
examples/gen_hero_svgs.rs (line 96)
88fn bar() -> String {
89    let cats = ["A", "B", "C", "D"];
90    Figure::new()
91        .size(PaperSize::A5Landscape)
92        .title("Test bench results")
93        .xlabel("specimen")
94        .ylabel("yield (MPa)")
95        .bar(&cats, &[320.0, 290.0, 410.0, 355.0], |b| {
96            b.label("trial 1").hatch(Hatch::Diagonal).group(0)
97        })
98        .bar(&cats, &[345.0, 305.0, 395.0, 380.0], |b| {
99            b.label("trial 2").hatch(Hatch::Crosshatch).group(1)
100        })
101        .legend_top_left()
102        .to_svg()
103}
More examples
Hide additional examples
examples/bar_grouped.rs (line 12)
3fn main() {
4    let cats = ["A", "B", "C", "D"];
5
6    let fig = Figure::new()
7        .size(PaperSize::A5Landscape)
8        .title("Test bench results")
9        .xlabel("specimen")
10        .ylabel("yield (MPa)")
11        .bar(&cats, &[320.0, 290.0, 410.0, 355.0], |b| {
12            b.label("trial 1").hatch(Hatch::Diagonal).group(0)
13        })
14        .bar(&cats, &[345.0, 305.0, 395.0, 380.0], |b| {
15            b.label("trial 2").hatch(Hatch::Crosshatch).group(1)
16        })
17        .legend_top_left();
18
19    std::fs::create_dir_all("out").expect("create out/");
20    std::fs::write("out/bar_grouped.svg", fig.to_svg()).expect("write svg");
21    println!("wrote out/bar_grouped.svg");
22}
Source

pub fn stroke_width(self, w: f64) -> Self

Trait Implementations§

Source§

impl Debug for BarOpts

Source§

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

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

impl Default for BarOpts

Source§

fn default() -> BarOpts

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