#582 Measures: totals on summaries, values on hover cards, and plugins (#575)
–
- github
- github/openchronology/timeline-app
- github/openchronology/timeline-app#582
- pull request
- state:merged
Closes #575, part 4 of #570. Stacked on #577–#581: until they merge, this diff includes their commits. Overview groups carry their measures' totals in every edition (#574). This PR shows them and lets plugins use them. ## Showing them - **Summaries:** - A label says what it holds, then up to two totals, each labelled and printed as its measure prints totals: `3 moments · Cost $21.50`. - The tooltip and the accessible name list all of them. - Separated tracks show their own totals. - Comparisons of several timelines show none, because each timeline declares its own measures. - **Single events:** hover cards list their values, as the reader does (#578). Server and desktop overviews now carry a marker's `measures` (up to 1 KiB) when a plugin is enabled, as they carry other plugin metadata. This also covers what #578 left for here. ## Plugins - **Scripts:** `api.measure(name)` reads a moment's value exactly. Scripts can compare it with `rational`, `compare`, `add`, `sub`, `mul` and `div`, the formatter language's exact arithmetic. - **`sizeBy: { "measure": "cost" }`:** sizes markers and summaries by their total, relative to the largest in view, in thirds: small, medium, large. - **Background chart:** `{ "kind": "measure", "measure": "cost" }` draws a measure's totals across the view instead of the count. Totals below zero count as zero, and a measure chart has no series. ## Tests - `test/measure-plugins.test.mjs` covers manifest validation, `api.measure` with exact comparisons, and projections. - The browser check now confirms that a summary's label and accessible name show `Cost $21.50`. I ran it locally in Chromium. - `npm test` passes, apart from the known local `contents.test`. Docs: `plugins.md` (measure charts, `sizeBy`, script methods) and `measures.md` (how totals are shown). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_011fFY8eruEi1xAkkMBni13B https://github.com/circagraph/timeline-app/pull/582
Related
- #570 Measures: typed quantities on moments and durations, totalled in every summary
- #574 Measures 3: totals in the summary trees (browser, PostgreSQL, SQLite)
- #575 Measures 4: totals in overviews, cluster labels, the plugin API and the background chart
- #577 Measures: declarations, exact values, validation and formats (#572)
- #578 Measures: presentation and parsing per measure, and editor fields (#573)
- #581 Measures: totals in the desktop file's SQLite index (#574)
- #583 Measures: durations count where they start (#576)
Open #582 Measures: totals on summaries, values on hover cards, and plugins (#575) in the timeline