Skip to content

tochart

Render charts in the terminal from a record stream.

Synopsis

bash
recs tochart [options] [files...]

Description

Render charts in the terminal from a record stream. Supports bar charts (horizontal Unicode block characters), line charts (braille-dot canvas), scatter plots (braille-dot canvas), and sparklines (vertical block characters). Can optionally write SVG output to a file.

Options

FlagDescription
--key / -k / --fields / -f <keys>Value keys to chart. May be specified multiple times or comma-separated. (required)
--type <type>Chart type: bar (horizontal bars), line (braille line plot), scatter (braille scatter), sparkline (compact block characters). Default: bar.
--title <title>Title displayed above the chart.
--width <n>Chart width in characters. Default: 80.
--height <n>Chart height in character rows. Default: 20.
--label-key <key>Key to use for bar labels or x-axis category names. If not specified, records are labeled by index.
--color / --no-colorEnable or disable ANSI color output. Colors are enabled by default.
--output-file <file>Write an SVG chart to the specified file instead of rendering to the terminal.
--dump-specDump parsed configuration and data lines (for testing).

Examples

Bar chart of counts by user

bash
recs tochart --key ct --label-key uid

Line chart of values

bash
recs tochart --key value --type line --title 'Values over time'

Scatter plot of x vs y

bash
recs tochart --key x,y --type scatter

Sparkline of a value field

bash
recs tochart --key value --type sparkline

Save chart as SVG

bash
recs tochart --key ct --label-key uid --output-file chart.svg

Multiple series bar chart

bash
recs tochart --key sales,profit --label-key region --title 'By Region'

See Also

Released under the MIT License.