Data Visualiser
Builds a chart from a stat and a filter set — two modes, two keys, and only one of them ever live.
/datavisualiser · src/composed/datavisualiser
Builds a chart from a stat and a filter set.
Two modes, two keys
The board answers a different question in each mode — one day in detail, or a window summarised — so it has two query keys and only one is ever live.
That is worth doing rather than one key with a mode parameter: the two responses have different shapes, and a single key would mean a union type threaded through every consumer plus a cache holding whichever shape arrived last.
The summary is a pure function
The 120-line summary reduce is summariseCoverage in summary.ts, where it can
be checked without a render. Same rule as
Build-Ups: computation out of the
component, so it can be tested against fixed inputs.
Charts
Chart.js with the annotation and datalabels plugins, wrapped by
react-chartjs-2. It is not shared with
admin, which charts different shapes — see
Packages for what is deliberately not shared.