Spaces:
Sleeping
Sleeping
Download web/src/lib/chart.ts from TBM99/CoverageCheck: direct link, hf CLI and curl.
- Browser
- Download file 1.38 kB
-
https://huggingface.co/spaces/TBM99/CoverageCheck/resolve/main/web/src/lib/chart.ts
- Command line
-
hf download hf://spaces/TBM99/CoverageCheck/web/src/lib/chart.ts
-
curl -L -o chart.ts https://huggingface.co/spaces/TBM99/CoverageCheck/resolve/main/web/src/lib/chart.ts
1.38 kB
| // 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 | |
| } | |