Crate poloto[][src]

poloto - plot to SVG and style with CSS

How do I change the color of the plots?

You can doing it by overriding the css. If you embed the generated svg into a html file, then you can add this example:

.poloto{
   --poloto_bg_color:"black";
   --poloto_fg_color:"white;
   --poloto_color0:"red";
   --poloto_color1:"green";
   --poloto_color2:"yellow";
   --poloto_color3:"orange";
   --poloto_color4:"purple";
   --poloto_color5:"pink";
   --poloto_color6:"aqua";
   --poloto_color7:"red";
}

By default these variables are not defined, so the svg falls back on some default colors.

Can I change the styling of the plots?

Yes! You can harness the power of CSS both in the svg, or outside in html with an embeded svg. Some things you can do:

  • Change the color scheme to fit your html theme.
  • Highlight one plot, make it dashed, or add hover effect
  • Animate things using @keyframes

Depending on whether you are adding a new style attribute or overriding an existing one, you might have to increase the specificty of your css clause to make sure it overrides the svg css clause.

Usage

  • Plots containing NaN or Infinity are ignored.
  • After 6 plots, the colors cycle back and are repeated.

Why not scale the intervals to end nicely with the ends of the axis lines?

Doing this you would have to either have more dead space, or exclude plots that the user would expect to get plotted. Neither of these sounded better than the option of just having the intervals stop not necessarily at the end of the axis lines.

Example

See the graphs in this report: broccoli_book

Modules

default_svg_tag

render_svg creates its own svg tag, and then calls Plotter::render. The default attributes set in that svg tag are in this module.

Structs

Plotter

Keeps track of plots. User supplies iterators that will be iterated on when render is called.

Functions

plot

Convenience function for Plotter::new()

render_svg

Function to write to a T that implements std::fmt::Write Makes a svg tag with the defaults defined in default_svg_tag.

render_to_string

Convenience function to just write to a string.