Struct poloto::Plotter [−][src]
Keeps track of plots. User supplies iterators that will be iterated on when render is called.
Implementations
impl<'a, T: Write + 'a> Plotter<'a, T>
[src]
pub fn new(writer: T) -> Plotter<'a, T>
[src]
pub fn line(
&mut self,
name: impl FnOnce(&mut T) -> Result + 'a,
plots: impl IntoIterator<Item = [f64; 2]> + 'a
)
[src]
&mut self,
name: impl FnOnce(&mut T) -> Result + 'a,
plots: impl IntoIterator<Item = [f64; 2]> + 'a
)
Create a line from plots.
Example
let data=[ [1.0f64,4.0], [2.0,5.0], [3.0,6.0] ]; use core::fmt::Write; let mut s=String::new(); let mut plotter = poloto::Plotter::new(&mut s); plotter.line(|w|write!(w,"cow"),data.iter().map(|&x|x))
pub fn line_fill(
&mut self,
name: impl FnOnce(&mut T) -> Result + 'a,
plots: impl IntoIterator<Item = [f64; 2]> + 'a
)
[src]
&mut self,
name: impl FnOnce(&mut T) -> Result + 'a,
plots: impl IntoIterator<Item = [f64; 2]> + 'a
)
Create a line from plots that will be filled underneath.
Example
let data=[ [1.0f64,4.0], [2.0,5.0], [3.0,6.0] ]; use core::fmt::Write; let mut s=String::new(); let mut plotter = poloto::Plotter::new(&mut s); plotter.line_fill(|w|write!(w,"cow"),data.iter().map(|&x|x))
pub fn scatter(
&mut self,
name: impl FnOnce(&mut T) -> Result + 'a,
plots: impl IntoIterator<Item = [f64; 2]> + 'a
)
[src]
&mut self,
name: impl FnOnce(&mut T) -> Result + 'a,
plots: impl IntoIterator<Item = [f64; 2]> + 'a
)
Create a scatter plot from plots.
Example
let data=[ [1.0f64,4.0], [2.0,5.0], [3.0,6.0] ]; use core::fmt::Write; let mut s=String::new(); let mut plotter = poloto::Plotter::new(&mut s); plotter.scatter(|w|write!(w,"cow"),data.iter().map(|&x|x))
pub fn histogram(
&mut self,
name: impl FnOnce(&mut T) -> Result + 'a,
plots: impl IntoIterator<Item = [f64; 2]> + 'a
)
[src]
&mut self,
name: impl FnOnce(&mut T) -> Result + 'a,
plots: impl IntoIterator<Item = [f64; 2]> + 'a
)
Create a histogram from plots. Each bar’s left side will line up with a point
Example
let data=[ [1.0f64,4.0], [2.0,5.0], [3.0,6.0] ]; use core::fmt::Write; let mut s=String::new(); let mut plotter = poloto::Plotter::new(&mut s); plotter.histogram(|w|write!(w,"cow"),data.iter().map(|&x|x))
pub fn render_no_default_tags(
self,
title: impl FnOnce(&mut T) -> Result,
xname: impl FnOnce(&mut T) -> Result,
yname: impl FnOnce(&mut T) -> Result
) -> Result<T, Error>
[src]
self,
title: impl FnOnce(&mut T) -> Result,
xname: impl FnOnce(&mut T) -> Result,
yname: impl FnOnce(&mut T) -> Result
) -> Result<T, Error>
You can override the css in regular html if you embed the generated svg. This gives you a lot of flexibility giving your the power to dynamically change the theme of your svg.
However, if you want to embed the svg as an image, you lose this ability. If embedding as IMG is desired, instead the user can insert a custom style into the generated svg itself.
All the plot functions don’t actually add anything to the document until a render
function is called.
So calls to this will append elements to the start of the document.
pub fn render(
self,
title: impl FnOnce(&mut T) -> Result,
xname: impl FnOnce(&mut T) -> Result,
yname: impl FnOnce(&mut T) -> Result
) -> Result<T, Error>
[src]
self,
title: impl FnOnce(&mut T) -> Result,
xname: impl FnOnce(&mut T) -> Result,
yname: impl FnOnce(&mut T) -> Result
) -> Result<T, Error>
Auto Trait Implementations
impl<'a, T> !RefUnwindSafe for Plotter<'a, T>
impl<'a, T> !Send for Plotter<'a, T>
impl<'a, T> !Sync for Plotter<'a, T>
impl<'a, T> Unpin for Plotter<'a, T> where
T: Unpin,
T: Unpin,
impl<'a, T> !UnwindSafe for Plotter<'a, T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,