Spaces:
Sleeping
Sleeping
File size: 1,375 Bytes
23d418f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | // Chart colours and ink, in one place (dataviz skill: the reference palette's first
// three categorical slots, validated all-pairs on our white surface: CVD dE >= 9.2,
// normal-vision dE >= 24). C, the system the page is about, takes slot 1 (blue, the
// app's accent); the mapping never changes from chart to chart. Aqua is under 3:1 on
// white, so every chart carries labels and a table view (the relief rule).
import type { GroupRow, SystemId } from './types'
export const SERIES: Record<SystemId, string> = { c: '#2a78d6', b: '#eb6834', a: '#1baf7a' }
export const ORDER: SystemId[] = ['a', 'b', 'c'] // legends and tables read A, B, C
export const INK = {
primary: '#0f172a', // slate-900: values, titles
secondary: '#475569', // slate-600: labels
muted: '#64748b', // slate-500: axis text
grid: '#e2e8f0', // slate-200: hairline grid
axis: '#cbd5e1', // slate-300: baseline
}
/** A group as the chart reads it: each system's accuracy and its interval as the
* [below, above] distances ErrorBar draws. */
export function chartRow(g: GroupRow, name: string) {
const row: Record<string, unknown> = { name, n: g.n }
for (const s of ORDER) {
const x = g[s]
if (!x) continue
row[s] = x.accuracy
row[`${s}_err`] = [x.accuracy - (x.ci[0] ?? x.accuracy), (x.ci[1] ?? x.accuracy) - x.accuracy]
row[`${s}_ci`] = x.ci
}
return row
}
|