Skip to main content

prepare_aggregate_xy

Function prepare_aggregate_xy 

Source
pub fn prepare_aggregate_xy(
    lf: &LazyFrame,
    schema: &Schema,
    spec: &AggregateSpec<'_>,
    sampling: &ChartSampling,
) -> Result<GroupedSeries>
Expand description

A line or scatter chart of Y aggregated per X (per time bucket of a temporal X), and per color group: one lazy group-by over every row of the view. A count needs no Y column; any other aggregate draws a series per Y column, or per color group of the first.

With cumulative on, each point is the running total of the rows up to the end of its X (its bucket), per series, in X order: a running sum of Y, or Y’s rates compounded, (1 + y1)(1 + y2)... - 1 over every row. Each bucket carries its rows’ sum (or the sum of ln(1 + y), which compounds the same), and the totals run across buckets; the aggregate is not used, but a count runs as a count of rows.