ela
Contents

ManualPackages

Charts and figures

In the terminalela --spec charts-and-figures

Numbers drawn for people, as strings: the same in a file as at a terminal, with no colour. The charts are drawn in block characters by the code the suite's terminal programs draw theirs with.

Built-inDoes
chart.bar(value, max, width = 40)Returns a bar width columns long filled to value/max in eighths of a column: ██████▍░░░
chart.bars(values, width = 40)Returns a map of labels to numbers as rows width columns wide: the label, the bar, the number. The bars run from 0 to the largest value; rows too narrow for the numbers leave them out
chart.spark(values, width = 40)Returns a list of numbers as a sparkline ▁▂▃▅▇█, one column each, the newest width of them; from 0 to the largest
md.render(text)Returns Markdown laid out for stdout: at a terminal styled (bold headings, emphasis, code in colour) and wrapped to its width; anywhere else as plain text, 80 columns wide
mem = sys.memory()bar = chart.bar($mem["used"], $mem["total"], 30)echo "memory $bar"rows = chart.bars({"web": 12, "db": 30, "cache": 4}, width = 50)echo $rowsnotes = md.render(file.read("NOTES.md"))echo $notes
  • A chart's width is a whole number of columns from 1 to 1000, 40 when the call gives none. Its numbers are 0 or more, and chart.bar's max above 0. A value past max draws a full bar.
  • md.render lays out headings, paragraphs, lists, quotes, code blocks and tables; a link shows its text. Code is never wrapped. ela --spec and ela.spec(topic) give their section laid out by it when stdout is a terminal, and as the Markdown it is written in anywhere else.