Skip to content

struct

Dataset

pub struct Dataset {
    pub xs: Vec<String>,
    pub times: Option<Vec<f64>>,
    pub series: Vec<Series>,
    pub footnote: Vec<String>,
    pub domain: Option<(f64, f64)>,
}

A chart's data: the x labels, and a series of values per measure.

Fields

xs

pub xs: Vec<String>

The x labels, in order.

times

pub times: Option<Vec<f64>>

xs as decimal years, when they're dates.

series

pub series: Vec<Series>

One series per measure.

footnote

pub footnote: Vec<String>

Footer text: where the data's from, its unit and any caveats.

domain

pub domain: Option<(f64, f64)>

A value range to include, so small multiples share a scale.

Methods

parts

pub fn parts(&self) -> (Dataset, Vec<Option<f64>>)

Without totals rows, so nothing is counted twice, plus each series' published total: ABS perturbation means parts may not add up to it.

is_empty

pub fn is_empty(&self) -> bool

Whether there's nothing to draw.

max

pub fn max(&self) -> f64

The largest value in any series.

min

pub fn min(&self) -> f64

The smallest value in any series.

Trait implementations