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
impl LineStyle
Sourcepub fn new() -> Self
pub fn new() -> Self
Examples found in repository?
More 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}
pub fn overlay(&mut self, other: &Self)
Sourcepub fn colour<T>(self, value: T) -> Self
pub fn colour<T>(self, value: T) -> Self
Examples found in repository?
More 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}
pub fn get_colour(&self) -> String
Sourcepub fn width<T>(self, value: T) -> Self
pub fn width<T>(self, value: T) -> Self
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}
pub fn get_width(&self) -> f32
Sourcepub fn linejoin<T>(self, value: T) -> Self
pub fn linejoin<T>(self, value: T) -> Self
Examples found in repository?
More 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}
pub fn get_linejoin(&self) -> LineJoin
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LineStyle
impl RefUnwindSafe for LineStyle
impl Send for LineStyle
impl Sync for LineStyle
impl Unpin for LineStyle
impl UnwindSafe for LineStyle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more