06 — Data
Charts
Hand-rolled SVG is the default: width="100%", a fixed height, a viewBox from the data range. Colors are foreground, muted-foreground and primary only. Encode categories and emphasis with solid versus dashed strokes, fill opacity and outline rings, never a new hue.
Hand-rolled SVG
Reference forms: timeline strip, differential line (zero-crossing fill in foreground above and primary below), paired curve (solid player, dashed opponent), share bars (the highlighted slice gets an outline ring, not a hue). Grid lines are muted-foreground at 0.15, the zero axis at 0.4, axis labels mono at 11px.
Observable Plot — the one sanctioned library
When scales, axes, many series or interaction genuinely warrant a library, Observable Plot is the single sanctioned choice: framework-agnostic SVG, no other chart library, no canvas libraries. Restyle it to the palette: explicit mark colors (never its default scheme), no color legend, square bars, muted grid marks, and axes in the mono label pattern.
import * as Plot from "https://cdn.jsdelivr.net/npm/@observablehq/plot@0.6/+esm";
const chart = Plot.plot({
width: 640, height: 240,
style: { background: "transparent", color: "var(--foreground)",
fontFamily: "var(--font-mono)", fontSize: "11px" },
x: { label: null }, y: { label: null },
marks: [
Plot.gridY({ stroke: "var(--muted-foreground)", strokeOpacity: 0.15 }),
Plot.ruleY([0], { stroke: "var(--muted-foreground)", strokeOpacity: 0.4 }),
Plot.lineY(data, { x: "t", y: "v", stroke: "var(--foreground)", strokeWidth: 1.5 }),
Plot.lineY(data, { x: "t", y: "u", stroke: "var(--muted-foreground)",
strokeWidth: 1.5, strokeDasharray: "4 3" }),
],
});
Rules
- Explicit palette colors per mark. Never Plot's default color scheme.
- No color legend. Series are told apart by solid versus dashed, by fill opacity, or by an outline ring.
- Square bars. Muted grid. Axes restyled to the mono label pattern.
- Tabular figures on every axis and every value.
- Hand-rolled SVG first; reach for Plot only when complexity earns it.