Struct graplot::Pie

source ·
pub struct Pie {
    pub segs: Vec<PieSegment>,
    pub title: String,
    pub radius: f64,
}
Expand description
use graplot::Pie;
// without labels: let pie = Pie::new([35., 25., 25., 15.]);
let draw = [(35., "label"), (25., "len"), (25., "labeled"), (15., "test")];
let mut pie = Pie::new(draw);
pie.set_title("title");
pie.show();

Fields§

§segs: Vec<PieSegment>§title: String§radius: f64

Implementations§

Examples found in repository?
examples/pie_chart.rs (line 7)
4
5
6
7
8
9
10
fn main() {
    // without labels: let pie = Pie::new([35., 25., 25., 15.]);
    let draw = [(35., "label"), (25., "len"), (25., "labeled"), (15., "test")];
    let mut pie = Pie::new(draw);
    pie.color(0, Color::new(0.6, 0.2, 0.3, 1.));
    pie.show();
}

sets the radius of the final circle. Default radius: 110.0

Colors the segment at the given index with the color. /// # Example

use graplot::{Pie, Color};
 
let mut pie = Pie::new([25., 20., 15., 15., 35.]);
pie.color(1, Color::new(0.2, 0.1, 0.3, 1.));
pie.show();
Examples found in repository?
examples/pie_chart.rs (line 8)
4
5
6
7
8
9
10
fn main() {
    // without labels: let pie = Pie::new([35., 25., 25., 15.]);
    let draw = [(35., "label"), (25., "len"), (25., "labeled"), (15., "test")];
    let mut pie = Pie::new(draw);
    pie.color(0, Color::new(0.6, 0.2, 0.3, 1.));
    pie.show();
}
Examples found in repository?
examples/pie_chart.rs (line 9)
4
5
6
7
8
9
10
fn main() {
    // without labels: let pie = Pie::new([35., 25., 25., 15.]);
    let draw = [(35., "label"), (25., "len"), (25., "labeled"), (15., "test")];
    let mut pie = Pie::new(draw);
    pie.color(0, Color::new(0.6, 0.2, 0.3, 1.));
    pie.show();
}

Trait Implementations§

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.