Struct graplot::Bar

source ·
pub struct Bar {
    pub bars: Vec<BarDesc>,
    pub ys: Vec<f64>,
    pub axis_desc: AxisDesc,
    pub desc: Desc,
}
Expand description
use graplot::Bar;
 
let mut bar = Bar::new(["Ferris", "Stefan", "Test"], &[100., 200., 700.]);
bar.set_title("title");
bar.set_xlabel("test");
bar.show();

Fields§

§bars: Vec<BarDesc>§ys: Vec<f64>§axis_desc: AxisDesc§desc: Desc

Implementations§

Examples found in repository?
examples/bar.rs (line 4)
3
4
5
6
7
8
fn main() {
    let mut bar = Bar::new(["Ferris", "Stefan", "Test"], &[100., 200., 700.]);
    bar.set_title("title");
    bar.set_xlabel("test");
    bar.show();
}
More examples
Hide additional examples
examples/bar_colored.rs (line 4)
3
4
5
6
7
8
9
fn main() {
    let mut bar = Bar::new([("Ferris", RED), ("Stefan", GREEN), ("Test", BLUE)], &[100., 200., 500.,]);
    bar.add(("Added", ORANGE), 400.);
    bar.set_title("title");
    bar.set_ylabel("test");
    bar.show();
}
Examples found in repository?
examples/bar.rs (line 5)
3
4
5
6
7
8
fn main() {
    let mut bar = Bar::new(["Ferris", "Stefan", "Test"], &[100., 200., 700.]);
    bar.set_title("title");
    bar.set_xlabel("test");
    bar.show();
}
More examples
Hide additional examples
examples/bar_colored.rs (line 6)
3
4
5
6
7
8
9
fn main() {
    let mut bar = Bar::new([("Ferris", RED), ("Stefan", GREEN), ("Test", BLUE)], &[100., 200., 500.,]);
    bar.add(("Added", ORANGE), 400.);
    bar.set_title("title");
    bar.set_ylabel("test");
    bar.show();
}
Examples found in repository?
examples/bar.rs (line 6)
3
4
5
6
7
8
fn main() {
    let mut bar = Bar::new(["Ferris", "Stefan", "Test"], &[100., 200., 700.]);
    bar.set_title("title");
    bar.set_xlabel("test");
    bar.show();
}
Examples found in repository?
examples/bar_colored.rs (line 7)
3
4
5
6
7
8
9
fn main() {
    let mut bar = Bar::new([("Ferris", RED), ("Stefan", GREEN), ("Test", BLUE)], &[100., 200., 500.,]);
    bar.add(("Added", ORANGE), 400.);
    bar.set_title("title");
    bar.set_ylabel("test");
    bar.show();
}

Colors the bar at the given index with the color.

use graplot::{Bar, Color};
 
let mut bar = Bar::new(["Red", "Green", "Blue"], &[200., 220., 250.]);
bar.color(0, Color::new(1., 0., 0., 1.,));
bar.color(2, Color::new(0., 0., 1., 1.,));
bar.show();
Examples found in repository?
examples/bar_colored.rs (line 5)
3
4
5
6
7
8
9
fn main() {
    let mut bar = Bar::new([("Ferris", RED), ("Stefan", GREEN), ("Test", BLUE)], &[100., 200., 500.,]);
    bar.add(("Added", ORANGE), 400.);
    bar.set_title("title");
    bar.set_ylabel("test");
    bar.show();
}
Examples found in repository?
examples/bar.rs (line 7)
3
4
5
6
7
8
fn main() {
    let mut bar = Bar::new(["Ferris", "Stefan", "Test"], &[100., 200., 700.]);
    bar.set_title("title");
    bar.set_xlabel("test");
    bar.show();
}
More examples
Hide additional examples
examples/bar_colored.rs (line 8)
3
4
5
6
7
8
9
fn main() {
    let mut bar = Bar::new([("Ferris", RED), ("Stefan", GREEN), ("Test", BLUE)], &[100., 200., 500.,]);
    bar.add(("Added", ORANGE), 400.);
    bar.set_title("title");
    bar.set_ylabel("test");
    bar.show();
}

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.