tui.chart
tui.chart KIND VAR [--data NAME --col COL [--label COL] [--last N]] [--class CLASS] [RENDERER ARG...]
Renders a chart or text block into VAR, lines joined by newlines, ready for tui.output PANE "$VAR".
Parameters
KIND: one ofbox divider alert table kv hbar vbar gauge sparkline linechart csv_hbar csv_vbar csv_linechart scatter boxplot forest heatmap histogram banner tree columns badges list quote. They are the renderers oflib/terminal_renderer.sh, which is read on the first use; their arguments and flags (-w 40,-h 8,-c GREEN) are the ones listed in Renderers.--class CLASS: put the colours of a theme class back after every reset in the output, so the chart keeps the background of the pane it is shown in.--data NAME: build the arguments from a dataset.--colnames the column (repeat it for several series),--labelthe column of the labels,--lastlimits to the newest rows.
KIND with --data |
Arguments built |
|---|---|
sparkline, histogram |
the values of --col |
hbar, vbar |
LABEL:VALUE per row (--label, default column 0) |
linechart, boxplot, forest |
one series NAME:v,v,v per --col |
table |
the --cols header and every row |
list |
the cells of --col |
Notes
- Colours and sizes are the renderer’s. Pass
-wto fit a pane. - The renderer file defines functions with generic names (
box,list,table,tree); they are defined in the app’s shell once aKINDis rendered.
Notes
- A size or scale flag (
-w,-h,-n,-m, …) whose value is not a number is refused (rc 1, a message on stderr): the renderers loop forever on one.
Returns: 1 for an unknown KIND, a KIND that does not take --data, an unknown dataset, or a renderer that refuses its arguments.
Example
tui.chart hbar out --data hosts --col load --label host -w 40
tui.output pane_load "$out"
