Skip to main content

Module axes

Module axes 

Source
Expand description

Axis ticks, labels, titles and grid for every chart. ratatui would cut or run labels together and draw titles over the plot, so datui picks ticks and draws labels and marks itself. Ticks fall on nice values (1, 2 or 5 times a power of ten, or calendar boundaries), about one label per 15 columns or 4 rows, never closer than two cells: a crowded axis takes a coarser step, then shorter labels (12.3k, yearless dates), keeping a fixed axis’s ends while anything fits. A title gets its own row, cut to fit, or is dropped.

Structs§

AxisSpec
One axis: its range, how its ticks are chosen and written, and its title.
Legend
A chart’s legend: a name per series, each in the style its series draws in.
Placed
An axis’s ticks as placed: each labeled tick’s cell and label, and the cells of every major and minor tick.
PlotAxes
A chart’s two axes and how they are drawn.
PlotFrame
Where a chart’s parts sit in its area.
TickSet
A way to tick an axis: where, the minor ticks between, and the labels at each level of detail.
Track
Where an axis’s values land on screen: cells cells from start, each split in sub dots by the marker the plot draws with.

Functions§

cut
text in at most width cells, cut with the ellipsis when longer.
fit_x_labels
The x labels fitting a row over columns span under a plot of track, each centered under its tick, kept on the row, LABEL_GAP cells apart: about one per 15 columns, coarser then shorter when crowded, none when even two do not fit.
fit_y_labels
The y labels for a plot whose rows are track, with at most width cells left of its axis: about one per four rows, each on its tick’s row, in the fullest form that fits the width and tells them apart.
resolution
The dots per cell, across and down, of a canvas drawn with marker.

Type Aliases§

TickLabel
A tick’s label at a level of detail, 0 the fullest; None past the shortest.