Skip to main content

Module chart_data

Module chart_data 

Source
Expand description

Prepare chart data from a LazyFrame: read the chart’s columns, then make points, bins or statistics. Every chart reads through read_columns: up to a row limit, spread across the table by the analysis sampler (not its first rows), returning RowsRead so the chart can say when it shows a sample.

Structs§

AggregateSpec
What an aggregated line or scatter chart groups by and makes of the rows.
Bar
One bar: its category (None for null) and value. Split by color, a row of bars per group (None for an empty group), valued at their total.
BarAggregate
What an aggregated bar chart groups by and makes of the rows.
BarData
A bar chart: one bar per category, in order, up to BAR_CAP.
BoxMarks
A box and its whiskers as line segments, the box half either side of center and the caps cap either side; Y in data values, X in whatever unit center is.
BoxPlotData
BoxPlotStats
Box plot stats for a column.
ChartDataResult
Result of preparing chart data: series points and x-axis kind for label formatting.
ChartSampling
How a chart reads its rows.
ChartXRangeResult
The X column’s range alone, for a line or scatter chart’s axes before any Y.
Clipped
A range that left values out: which, and how many.
ColorSplit
A color split: the column and the values given a group each, in color order (None for nulls). With other, all other values form one more group, OTHER.
GroupedSeries
Series of a line or scatter chart, each named: a Y column’s or a color group’s.
HeatmapData
Heatmap data for two numeric columns.
HeldRows
The rows a chart last read from one view: other bins, ranges, bandwidths or charts over the same columns draw from them, describing one sample. Shared with the reading worker; the view’s owner starts a new one when the view changes.
HistogramBin
Histogram bin (center and count).
HistogramData
Histogram data for a single column.
HistogramGroup
One group’s bins of a histogram split by a color: its count (or share) per bin, on the bins of the whole.
KdeData
KdeSeries
KDE series and bounds.
RowsRead
What a chart read: the rows the table has, and how many of them were sampled when that was fewer.
ValueRows
A column’s values with the rows holding each, most rows first (equal counts in the column’s order), counted over the whole view.

Enums§

BarOrder
The order of a bar chart’s bars, top to bottom.
ValueRange
Which values a histogram, box plot or KDE draws. Outliers far from the body squash it into a bin or two; a percentile range leaves them out and says how many.
XAxisTemporalKind
Describes how x-axis numeric values map to temporal types for label formatting.

Constants§

AGGREGATE_POINTS_MAX
Most points an aggregated chart keeps. Past this X is close to a value per row, and a time bucket is what it needs.
BAR_CAP
Most bars a bar chart prepares; the rest are counted, not drawn. More than a tall terminal shows, few enough that an export stays legible.
COUNT_CATEGORY_CAP
Categories a count keeps before it stops: past this the column is an identifier, not a category, and a count per value would hold as much as the table.
OTHER
The name of the group of every value not given one of its own.

Functions§

accumulate
Make points cumulative along X: a running sum, or returns compounded (each value a rate; the point is what 1 grew to, less 1).
chart_notes
The chart’s notes under the plot, one line each: that it is a sample (with its seed) and how many values a range left out. Empty when it shows everything.
color_groups
The groups a color makes: the values picked, in the order picked, or else the largest by rows; at most most, one per series color.
drawing_order
The order n series are drawn in: Other first, under the series drawn over it.
group_label
A group’s name as a legend writes it.
is_category_dtype
Column types a bar chart takes as its category: text, categories, booleans and integers. A float or a timestamp is a measure, not a category.
other_at
Where Other is among n series: the last, when there is one.
prepare_aggregate_xy
A line or scatter of Y aggregated per X (per time bucket for temporal X) and per color group, in one lazy group-by over the view. A count needs no Y; other aggregates draw a series per Y column (or color group of the first). Cumulative: each point is the running total through its X, per series: a running sum, or compounded rates (1 + y1)(1 + y2)... - 1 (via summed ln(1 + y)); the aggregate is ignored, except a count runs as a row count.
prepare_bar_aggregate
A bar chart of value aggregated per category (and color group) in one lazy group-by; a count needs no value column, and uncolored is the exact count chart.
prepare_bar_counts
A bar chart of rows per category, exact: the whole view is counted in one streamed pass keeping only counts (or the held rows, if they are the whole view). Past COUNT_CATEGORY_CAP categories the count stops and says so.
prepare_bar_data
A bar chart, one bar per row: category from category, length from value. Expects a grouped result and refuses a repeated category rather than guess. A null category is its own bar; a null value is left out, counted in no_value.
prepare_box_by
Prepare one box of column per group of by: a box per category. The range is each group’s own, as each box describes its group.
prepare_box_plot_data
The box plot of one numeric column.
prepare_chart_data
XY series from the LazyFrame, X cast to f64 (temporals as ordinals). Nulls drop per series (a null X drops the row, a null Y breaks that series’ line). Points in X order, ties in table order. With envelope, a view larger than the sample size is cut into steps, each drawing its low and high Y, keeping peaks a sample would miss; it reads twice, so only where ChartSampling::full_passes allows, stopping on ChartSampling::cancel.
prepare_chart_x_range
Loads only the x column and returns its min/max (for axis display when no y is selected).
prepare_heatmap_data
Prepare heatmap data for two numeric columns. A row counts when both are present.
prepare_histogram_by
A histogram of column, split by color into groups on the same bins. With share, a bin is its share of its group’s rows so groups of different sizes compare. The range is the whole column’s, so every group clips alike.
prepare_kde_by
Prepare one density curve of column per group of color. The range is the whole column’s, so every curve is clipped alike.
prepare_kde_data
The density curve of one numeric column.
prepare_xy_by
A line or scatter chart of y split by color, from the rows a chart samples: one series per group, in X order, each breaking where its Y has no value.
segments
A series split at its breaks: the runs a line joins.
value_rows
Count column’s values over the whole view, or take the count held for it: one streamed pass that keeps a count per value, the one a bar chart of counts makes.
x_axis_label_at
An x tick at detail level (0 fullest), None past the shortest form. Narrow axes step down until labels fit: a date to year-month then year (or month-day when bounds fall in one year); a datetime to its date (or the minute within one day); a time to the minute. Numbers, and times out of range, use numbers.
x_axis_temporal_kind_for_column
Returns the x-axis temporal kind for a column from the schema (for axis label formatting when no data is loaded yet).