pub struct Series {
pub label: String,
pub values: Vec<Option<f64>>,
pub colour: Option<String>,
pub stack: Option<String>,
pub filled: bool,
pub tension: f64,
pub right_axis: bool,
}Expand description
A named run of numbers.
A gap in the data is None, not zero: Chart.js breaks the line there,
which is what “we have no reading for March” looks like. Zero is a reading.
Fields§
§label: String§values: Vec<Option<f64>>§colour: Option<String>Overrides the palette. None lets the chart assign one by position,
which is what keeps two charts on a page agreeing about which colour
means which series.
stack: Option<String>Bars and lines only: stack with every other series naming the same group.
filled: boolLines only: fill the area beneath.
tension: f64Lines only. 0 is straight segments; Chart.js’s own default is 0.4, which invents a curve between points nobody measured.
right_axis: boolPlot against the right-hand axis. For a second unit — rupiah on the left, a count on the right.
Implementations§
Source§impl Series
impl Series
pub fn new( label: impl Into<String>, values: impl IntoIterator<Item = f64>, ) -> Series
Sourcepub fn sparse(
label: impl Into<String>,
values: impl IntoIterator<Item = Option<f64>>,
) -> Series
pub fn sparse( label: impl Into<String>, values: impl IntoIterator<Item = Option<f64>>, ) -> Series
With gaps. None breaks the line rather than drawing it through zero.
pub fn colour(self, colour: impl Into<String>) -> Series
pub fn stack(self, group: impl Into<String>) -> Series
pub fn filled(self) -> Series
Sourcepub fn smooth(self) -> Series
pub fn smooth(self) -> Series
Round the corners between points. Only honest when the thing measured really is continuous.