# Charts

The shared charts, key, tooltip, event list and table marks, each shown on real-looking data.

An article that shows data uses these and writes no chart code of its own. Each
chart is one server-rendered SVG on the plot kit, drawn in the site's pens,
weights and type, and usable from MDX as it stands. They take the shape of
Tremor's charts (`data`, `index`, `categories`, `colors`, `valueFormatter`)
restyled wholly on the site's tokens.

Every series is told apart by more than colour. A line has a dash and a point
shape, a bar a fill (solid, hatch, dots, cross or a dither density), so a chart
reads in one ink and in a greyscale print. Each chart is one image with a
title and a description written from its data, a tooltip that answers to the
pointer and to the arrow keys, and its numbers in a hidden table for assistive
technology. A wide drawing keeps its size in a narrow column and scrolls; a
`narrow` prop gives it a second drawing for a phone.

## Line chart

A line per column, a numeric index on a true scale, a target as a reference
line and the days of interest as a band. Hover the chart, or tab to it and use
the arrow keys.

**Requests per hour stay under the limit except at the peak.** Requests per hour on the two routes, 09:00 to 20:00. The dashed line is the limit; the hatched band is the launch window.

With `area`, each line hatches down to the baseline; with `curve="step"` it
steps; with a short index the points are marked. A line with gaps breaks at
them unless `connectNulls` is set.

**Memory climbs to a plateau.** Resident memory of the worker in megabytes, sampled every five minutes, with a gap where the probe was down.

## Bar chart

Grouped by default. A pattern per series is the second channel.

**Scores rose on every task but parsing.** Task score before and after the change, out of 100.

`type="stacked"` stacks the series, `type="percent"` stacks to a hundred
percent, and `layout="horizontal"` lays the bars across with the names down the
side.

**Most failures are timeouts.** Failed runs by cause and week, counted over the four weeks of the trial.

A log axis carries values that run over orders of magnitude, and long names move
above their bars when the drawing is narrow: this one has a second drawing for
a phone.

**Extraction costs a few dollars where the actors cost thousands.** Estimated cost per million records, dollars on a log scale; the fill is the group.

## Dot plot

One dot per series on a shared axis, joined across a row: the gap reads where
bars would hide it, and the axis need not start at zero.

**Every model gained, some by a lot.** Pass rate on the held-out set before and after tuning, per model, percent.

## Histogram

Values counted into round-edged bins. Pass one list, or named lists to overlay.

**Slow runs make a second hump.** Run time in seconds across 200 runs, fast and slow hosts overlaid.

## Scatter

Two numeric columns, split into series by a column and sized by another. Each
point answers to the pointer, to its nearest neighbour.

**Bigger inputs cost more, and the large model costs most.** Latency against input size for three models, point area by cost per call.

## Heatmap

A grid in which tone, printed as ordered dither in one pen, carries the value.
The ramp under it names the lowest and the highest; the cells can carry their
values.

**Retrieval is the weak task for every model.** Score of each model on each task, out of 1. Darker is higher.

## Spark

A sparkline sits in a line of text or a table cell. The last month of requests
is  up
by half, and the error rate  down by
three quarters. Each one has a name that reads its range to a screen reader.

**Routes at a glance**

| Route    | Requests | Errors | Last eight weeks |
| -------- | -------: | -----: | ---------------- |
| Search   |    4,810 |     12 |                  |
| Checkout |    1,920 |     31 |                  |
| Account  |      640 |      3 |                  |

## Several charts, one figure

`ChartRow` sets two or three charts side by side in a wide column and one above
the other in a narrow one, and `Ledger` is the numbered key under them. Each
chart carries its own panel title in `yLabel`. A line chart takes a log axis
for a numeric index (`xScale="log"`, ticks at the powers of ten, or at 1, 2 and
5 over a short span), the settings of a sweep spaced evenly (`categorical`), an
area from a chosen level (`areaFrom`, the gain over a baseline), words beside a
point (`notes`), and a dash and a point shape per series.

**Two sweeps of one device.** Accuracy against two knobs; the dashed line is chance, and the hatched area is the gain over raw samples.

A grouped bar chart takes error bars (`errors`, the column holding each
half-width) and a dashed tick across each row (`rowMarks`, chance for that
task), and a `Legend` item with `whisker` names them.

**Three tasks.** Mean over three seeds with one standard deviation.

## Key

A key in HTML for any chart or plate, in the same pens, patterns, dashes and
shapes the drawing uses. The charts above carry their own; use this beside a
plate a piece drew itself.

## Tooltip

`ChartTip` is the tooltip the charts use, and it wraps any SVG plate: give the
places that answer as `tips` in the drawing's own coordinates, and the card
shows on hover, touch and focus. It is one tab stop; the arrow keys, Home and
End step through the places and the current one is read out. The card lives
inside its wrapper, not on the page body, so it still shows inside the player
in full screen.

## Table marks

A `Mark` in a cell says what holds, what fails and what was not scored, by
shape: a filled dot, a hollow one, a dashed ring. `numeric` aligns number
columns in tabular figures.

| Claim                         | Held | Effect |
| ----------------------------- | ---- | ------ |
| Caching cuts latency          |      | 38     |
| Retries fix timeouts          |      | -4     |
| Smaller prompts keep accuracy |      | 12     |
| Tuning transfers to new tasks |      | n/a    |

**Which claims held up.** Each claim of the trial against the check that tested it.

## Event list

A dated list for a replay's notes or a feed. A filled dot happened, a dashed
ring is expected, a struck one was withdrawn.

**Run notes.** Times are the worker's clock.