references/craft/data-viz.md
about 430 tokens- greenline
# Data visualisation
Read this page when a change draws a chart, a meter, a sparkline or any figure of data.
## The rules you judge
1. The question picks the form: one line over time, square-cornered columns per period, an equal-bin histogram for a distribution, a sorted horizontal bar list for a ranking, a thin ring or a full stacked bar of five parts at most for a share, a bar labelled at both ends for progress to a target, and no chart for a few numbers.
2. One series per chart, three at most; other measures are switched with a control rather than overlaid.
3. The axes are honest: there is always a scale, ticks are round and even with the top tick above the maximum, bars and counts start at zero, time sits on a time scale, lines are straight segments, three to five faint gridlines, four to eight flat labels on the x axis, and axis text never larger than the data.
4. One hue per chart, on the main data element; a subject keeps its hue across the screen, and more than four hues is a warning. Colour means good or bad, never up or down; a zero or undefined change is grey.
5. Colour never carries meaning alone.
6. A single series has no legend; otherwise five items at most, each swatch the mark itself.
7. A spike over about three times the usual change gets a marker and a cause; reference lines are dashed and labelled; a forecast is dashed after today.
8. An empty or short history is drawn honestly: a zero line, missing bars, no padded range.
9. Decimals are fixed per measure, money 2, percentages 1 to 2, counts 0, with thousands separators and right alignment.
## The phone
A chart runs full width at 160 to 200 pixels tall, with three or four labels on the x axis and the legend's dots above it.