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 turn them into points, bins or statistics.

Every chart reads its rows through [read_columns]: up to a row limit of them, spread across the table by the sampler the analysis tools use, so a chart shows the table and not its first rows. What was read comes back as 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.
AxisFormat
How every tick of one numeric axis is written: one notation and one precision for all of them, chosen from the ticks, in the table’s grouping and decimal separator. Chosen per tick, an axis switched to scientific notation partway up.
AxisNumbers
What a numeric axis holds: the table’s format for its numbers, and whether they are whole (counts, an integer column), which ticks the axis only at whole numbers.
Bar
One bar: its category (None for a null category) and its value. Split by a color, a bar is a row of bars, one per group (None where a group has no rows), and its value is 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.
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
Result of loading only the x column: min/max for axis bounds and temporal kind.
Clipped
A range that left values out: which, and how many.
ColorSplit
A column a chart is split by, and the values given a group each, in color order. None is the rows with no value. With other, every other value’s rows make one more group after them, 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. Another bin count, range, bandwidth or chart over columns already read draws from them instead of reading the table again, and every chart of the view describes the same sample. Shared with the worker that reads; whoever owns the view 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.
BarValue
What sets a bar’s length: a numeric column, one row per category, or how many rows each category has.
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
What a chart says under the plot about its input, one line each: that it is a sample, with the seed that draws it again, and how many values a range left out. Empty when it shows every row and every value. middot joins the seed on.
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.
format_bar_value
Format a bar’s value for the label beside it in format: an integer column’s whole, anything else to the format’s decimal places or two, so every bar shows the same number of them. Values too large, or too small to show in those places, go to scientific notation.
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.
prepare_aggregate_xy
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.
prepare_bar_aggregate
A bar chart of value aggregated per category (and per color group): one lazy group-by over every row of the view. A count needs no value column; one without a color is the exact count a bar chart of counts draws.
prepare_bar_counts
Prepare a bar chart of how many rows each category has. The counts are exact: the whole view is counted, whatever the sample size, in one streamed pass that keeps a count per category and no rows. When the rows held are the whole view, those are counted instead. Past COUNT_CATEGORY_CAP categories the count stops, and says so rather than drawing part of the view as the whole.
prepare_bar_data
Prepare a bar chart: one bar per row, the category from category, the length from value. The chart takes a grouped result — one row per category — and refuses a category that repeats rather than guess how to combine its rows. A null category is a bar of its own; a null value leaves its category 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
Prepare box plot stats for one or more numeric columns. Uses a single read for all columns.
prepare_chart_data
Prepares XY series from the current LazyFrame. X is cast to f64 (temporal types as ordinal). Nulls are dropped per series: a null X drops the row, a null Y drops that series’ point and breaks its line. Points come in X order, so a line runs left to right whatever order the rows are in; ties keep table order.
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
Prepare a histogram of column, split by color into groups on the same bins when given. With share, a bin is its share of its group’s rows (of every row, unsplit), so groups of different sizes compare. The range is the whole column’s, so every group is clipped alike.
prepare_histogram_data
Prepare histogram data for a numeric column.
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
Prepare KDE data for one or more numeric columns. Uses a single read for all columns.
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.
table_number_format
The format the table prints column in, plain where it prints it unformatted.
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 level of detail, 0 the fullest, or None past the shortest form. A narrow axis steps down until its labels fit: a date to year-month and then the year, or to month-day when both ends of the axis, bounds, fall in one year; a datetime first to its date, or to the minute when the axis spans one day; a time to the minute. A number, or a time past what it can stand for, is written in 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).