cat / 012
clone

a spreadsheet for the terminal: lotus 1-2-3 looks, google sheets keys and formulas, one go binary

cat/module-path
012 / docs / sheets / charts.md
charts.md 3.4K rendered
1---2title: "Charts"3sidebar_position: 104---56# Charts78![Inserting a chart from the palette, switching its type, and watching it follow its data](../media/charts.gif)910Insert > Chart charts the selection, or the table around the active cell,11guessing the header row, the label column and a title. The chart floats over12the grid, pinned to a cell, and redraws when its data changes.1314The chart editor is a bar on the context line: Left/Right (or 1 to 6) picks15column, bar, line, pie, area or scatter; S switches series between rows and16columns; H and L toggle the header row and labels; R points at a new range;17T edits the title. Enter keeps the changes, Esc undoes them.1819| Type | Draws |20|---|---|21| Column, Bar | a bar per series in each category; K cycles Not stacked, Stacked and 100% stacked |22| Line | a line per series |23| Area | a line per series filled down to the axis, the smaller series in front; K stacks them as columns do |24| Pie | the first series as slices, with each slice's share |25| Scatter | the first series as X and every other one as Y against it, as in Sheets (with one series, the labels are X when they're numbers); E adds a linear trend line per series |2627A opens a second bar, as Sheets' Customize tab: N and X type the value28axis' minimum and maximum (a number as a cell takes one, blank for29automatic; values past a fixed end stop at it), L puts it on a log scale30(values that aren't positive are left out, and its ends round out to31powers of ten), G turns the gridlines off and on, and P moves the legend32between the bottom, the right and none. A legend lists two series or more,33and a pie's legend of slices always sits on its right. Enter or Esc goes34back to the first bar, keeping the changes. On the value axis of a bar35chart these options apply along the bottom; on a scatter, to Y.3637Click a chart to select it. Drag it to move it, drag its corner to resize it,38or use the arrows and Shift+arrows; Enter edits it, Del deletes it, and39right-click offers both. In terminals that say when a key is let go40([Keys the terminal has to tell apart](../reference/keys.md#keys-the-terminal-has-to-tell-apart)),41holding Space on a selected chart shows it across the grid until Space42is let go. Charts follow inserted and deleted rows and43columns, and save with the sheet.4445**Images or text.** At startup 012 asks the terminal whether it supports the46kitty graphics protocol. Where it does (kitty, Ghostty, WezTerm) the plot is47a real image, drawn in the terminal's own palette and placed with Unicode48placeholders, so redraws never erase it. Otherwise, where the terminal49lists sixel graphics among its device attributes (foot, xterm, mlterm,50Windows Terminal, and terminals built on xterm.js with its image addon51on, such as VS Code with `terminal.integrated.enableImages`), the plot is52a sixel image in the terminal's palette, in as many colors as it has53color registers. A sixel image is drawn over the finished screen, on top54of the text chart, which it covers whole: a terminal that lists sixel but55doesn't show the image shows the text chart. The56image shows only where its whole plot area does: a chart scrolled partly57out of the grid, or under another chart, a menu or a dialog, is text58until it shows whole again, and the image is drawn again after59scrolling, resizing or an edit to its data. Elsewhere, and inside tmux,60the plot is drawn with block and braille characters. Axis labels, the61legend and the frame are text either way.