pub struct Chart<'a, P>where
P: IntoPoint,{ /* private fields */ }
Expand description
Chart for plotting data to SVG
Multiple Plot
s can be rendered in a single Chart, even with unrelated
domains and axes.
Implementations§
Source§impl<'a, P> Chart<'a, P>where
P: IntoPoint,
impl<'a, P> Chart<'a, P>where
P: IntoPoint,
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new chart
Examples found in repository?
More examples
examples/area.rs (line 7)
3fn main() {
4 let data_a = vec![(13, 74), (111, 37), (125, 52), (190, 66)];
5 let data_b = vec![(22, 50), (105, 44), (120, 67), (180, 39)];
6 let page = Page::new().chart(
7 Chart::new()
8 .title("Area Plot")
9 .domain(&data_a[..])
10 .axis("X Axis", Edge::Bottom)
11 .axis("Y Axis", Edge::Left)
12 .axis("", Edge::Right)
13 .plot(Plot::area("Series A", &data_a))
14 .plot(Plot::area("Series B", &data_b)),
15 );
16 print!("{page}");
17}
examples/scatter.rs (line 7)
3fn main() {
4 let data_a = vec![(13, 74), (111, 37), (125, 52), (190, 66)];
5 let data_b = vec![(22, 50), (105, 44), (120, 67), (180, 39)];
6 let page = Page::new().chart(
7 Chart::new()
8 .title("Scatter Plot")
9 .domain(&data_a[..])
10 .axis("X Axis", Edge::Bottom)
11 .axis("Y Axis", Edge::Left)
12 .axis("", Edge::Right)
13 .plot(Plot::scatter("Series A", &data_a).label())
14 .plot(Plot::scatter("Series B", &data_b)),
15 );
16 print!("{page}");
17}
Sourcepub fn aspect_ratio(self, aspect: AspectRatio) -> Self
pub fn aspect_ratio(self, aspect: AspectRatio) -> Self
Adjust the aspect ratio
Sourcepub fn domain<D>(self, domain: D) -> Self
pub fn domain<D>(self, domain: D) -> Self
Set the domain
Panics if called after axis
or plot
.
Examples found in repository?
More examples
examples/area.rs (line 9)
3fn main() {
4 let data_a = vec![(13, 74), (111, 37), (125, 52), (190, 66)];
5 let data_b = vec![(22, 50), (105, 44), (120, 67), (180, 39)];
6 let page = Page::new().chart(
7 Chart::new()
8 .title("Area Plot")
9 .domain(&data_a[..])
10 .axis("X Axis", Edge::Bottom)
11 .axis("Y Axis", Edge::Left)
12 .axis("", Edge::Right)
13 .plot(Plot::area("Series A", &data_a))
14 .plot(Plot::area("Series B", &data_b)),
15 );
16 print!("{page}");
17}
examples/scatter.rs (line 9)
3fn main() {
4 let data_a = vec![(13, 74), (111, 37), (125, 52), (190, 66)];
5 let data_b = vec![(22, 50), (105, 44), (120, 67), (180, 39)];
6 let page = Page::new().chart(
7 Chart::new()
8 .title("Scatter Plot")
9 .domain(&data_a[..])
10 .axis("X Axis", Edge::Bottom)
11 .axis("Y Axis", Edge::Left)
12 .axis("", Edge::Right)
13 .plot(Plot::scatter("Series A", &data_a).label())
14 .plot(Plot::scatter("Series B", &data_b)),
15 );
16 print!("{page}");
17}
Sourcepub fn title<T>(self, title: T) -> Self
pub fn title<T>(self, title: T) -> Self
Add a chart title
Panics if called after axis
or plot
.
Examples found in repository?
More examples
examples/area.rs (line 8)
3fn main() {
4 let data_a = vec![(13, 74), (111, 37), (125, 52), (190, 66)];
5 let data_b = vec![(22, 50), (105, 44), (120, 67), (180, 39)];
6 let page = Page::new().chart(
7 Chart::new()
8 .title("Area Plot")
9 .domain(&data_a[..])
10 .axis("X Axis", Edge::Bottom)
11 .axis("Y Axis", Edge::Left)
12 .axis("", Edge::Right)
13 .plot(Plot::area("Series A", &data_a))
14 .plot(Plot::area("Series B", &data_b)),
15 );
16 print!("{page}");
17}
examples/scatter.rs (line 8)
3fn main() {
4 let data_a = vec![(13, 74), (111, 37), (125, 52), (190, 66)];
5 let data_b = vec![(22, 50), (105, 44), (120, 67), (180, 39)];
6 let page = Page::new().chart(
7 Chart::new()
8 .title("Scatter Plot")
9 .domain(&data_a[..])
10 .axis("X Axis", Edge::Bottom)
11 .axis("Y Axis", Edge::Left)
12 .axis("", Edge::Right)
13 .plot(Plot::scatter("Series A", &data_a).label())
14 .plot(Plot::scatter("Series B", &data_b)),
15 );
16 print!("{page}");
17}
Sourcepub fn axis(self, name: &'a str, edge: Edge) -> Self
pub fn axis(self, name: &'a str, edge: Edge) -> Self
Add an Axis
Panics if called after plot
.
Examples found in repository?
More examples
examples/area.rs (line 10)
3fn main() {
4 let data_a = vec![(13, 74), (111, 37), (125, 52), (190, 66)];
5 let data_b = vec![(22, 50), (105, 44), (120, 67), (180, 39)];
6 let page = Page::new().chart(
7 Chart::new()
8 .title("Area Plot")
9 .domain(&data_a[..])
10 .axis("X Axis", Edge::Bottom)
11 .axis("Y Axis", Edge::Left)
12 .axis("", Edge::Right)
13 .plot(Plot::area("Series A", &data_a))
14 .plot(Plot::area("Series B", &data_b)),
15 );
16 print!("{page}");
17}
examples/scatter.rs (line 10)
3fn main() {
4 let data_a = vec![(13, 74), (111, 37), (125, 52), (190, 66)];
5 let data_b = vec![(22, 50), (105, 44), (120, 67), (180, 39)];
6 let page = Page::new().chart(
7 Chart::new()
8 .title("Scatter Plot")
9 .domain(&data_a[..])
10 .axis("X Axis", Edge::Bottom)
11 .axis("Y Axis", Edge::Left)
12 .axis("", Edge::Right)
13 .plot(Plot::scatter("Series A", &data_a).label())
14 .plot(Plot::scatter("Series B", &data_b)),
15 );
16 print!("{page}");
17}
Sourcepub fn plot(self, plot: Plot<'a, P>) -> Self
pub fn plot(self, plot: Plot<'a, P>) -> Self
Add a Plot
Examples found in repository?
More examples
examples/area.rs (line 13)
3fn main() {
4 let data_a = vec![(13, 74), (111, 37), (125, 52), (190, 66)];
5 let data_b = vec![(22, 50), (105, 44), (120, 67), (180, 39)];
6 let page = Page::new().chart(
7 Chart::new()
8 .title("Area Plot")
9 .domain(&data_a[..])
10 .axis("X Axis", Edge::Bottom)
11 .axis("Y Axis", Edge::Left)
12 .axis("", Edge::Right)
13 .plot(Plot::area("Series A", &data_a))
14 .plot(Plot::area("Series B", &data_b)),
15 );
16 print!("{page}");
17}
examples/scatter.rs (line 13)
3fn main() {
4 let data_a = vec![(13, 74), (111, 37), (125, 52), (190, 66)];
5 let data_b = vec![(22, 50), (105, 44), (120, 67), (180, 39)];
6 let page = Page::new().chart(
7 Chart::new()
8 .title("Scatter Plot")
9 .domain(&data_a[..])
10 .axis("X Axis", Edge::Bottom)
11 .axis("Y Axis", Edge::Left)
12 .axis("", Edge::Right)
13 .plot(Plot::scatter("Series A", &data_a).label())
14 .plot(Plot::scatter("Series B", &data_b)),
15 );
16 print!("{page}");
17}
Trait Implementations§
Auto Trait Implementations§
impl<'a, P> Freeze for Chart<'a, P>
impl<'a, P> RefUnwindSafe for Chart<'a, P>where
P: RefUnwindSafe,
impl<'a, P> Send for Chart<'a, P>where
P: Sync,
impl<'a, P> Sync for Chart<'a, P>where
P: Sync,
impl<'a, P> Unpin for Chart<'a, P>
impl<'a, P> UnwindSafe for Chart<'a, P>where
P: RefUnwindSafe,
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