Dokumentation · Siderne
The dense time series chart
DenseTimeChart in @elo/charts (epic B18; specification docs/architecture/phase-1.md section 11.2, notation
manual sections 4, 5, 6 and 9). It is the tier chart of page D1: consumption, the emission factor and Scope 2
emissions of one metering point on one time axis, by hour or quarter-hour, for up to 31 days.
Source: web/packages/charts/src/components/DenseTimeChart.tsx and src/core/dense.ts. The package is vendored:
edit the overlays in tools/vendor_web/charts/ and run uv run --locked --all-packages python -m elo_devtools.vendor_web.
Use
<DenseTimeChart
intervals={rows} // one row per expected interval (mp.series / mp.emission_intervals)
from="2026-11-02" to="2026-11-08" grain="hour"
scale={{ kwh: response.scale.kwh.max }} // optional: one scale per unit on the page
title="Rådhuset, hovedmåler: forbrug, emissionsfaktor og udledning pr. time, 2.–8. nov 2026"
/>
A row (DenseInterval): start (ISO instant, UTC), optional end (when not start + grain), kwh, quality
("A01"…"A05" or null), and for the emission tiers factor (g CO₂e/kWh), factorVersion ("Final",
"Preliminary", "Initial" or null) and co2e (g CO₂e, the amount of section 9.2). Without any factor field only
the consumption tier is drawn; tiers chooses explicitly.
What it draws
| Rule | How |
|---|---|
| True to time | x is a function of the instant. The window is [local midnight of from, local midnight after to); a 23- or 25-hour day is 23/24 or 25/24 as wide as a normal day. An interval without a row is drawn as missing at its place |
| Marks | Columns of two thirds of the interval up to 169 intervals (the week of hours that holds the 25-hour day); beyond it one <path> per tier and certainty, without markers. The factor is always a thin line (1,25 px); a quantity line is 2,5 px |
| Quality (manual §9) | A04 and A01 solid; A03 hatched (the forecast's pattern); A05 solid with the missing symbol (dashed 7 px square); A02 or no value an empty band with dashed edges and mangler 14 t. A factor that is not Final makes the emission hatched and the factor line dashed (4 on, 3 off); an interval with a row but no factor is afventer faktor in the factor and emission tiers, while its consumption is drawn; where the query returned no row at all, nothing is known and every tier says mangler; a row with neither a reading nor a factor (an interval nothing is stored for) is mangler in the factor and emission tiers too, not afventer faktor (B16b). The tooltip and the table use the same word as the drawing for each state. A line is never drawn across a gap; a value between two gaps is a short stroke across its interval |
| Units | Consumption from a kWh base (kWh, MWh, GWh), emissions from g CO₂e (g, kg, t, kt), chosen so that the largest value (or scale) shows at most three digits; the unit is "pr. time" or "pr. kvarter" after the intervals the rows have (an hourly series at quarter-hour grain is "pr. time") |
| Mixed resolutions (manual §5, N23) | One unit per tier for the whole window. Where the rows mix hours and quarter-hours (a resolution switch), consumption is drawn as average power, the energy divided by the interval's length (Forbrug, gennemsnitlig effekt, kW), and emissions per hour (Scope 2, el, gennemsnit, kg CO₂e pr. time), so that equal loads are equally high. The table still lists each interval's energy in kWh and emission in g/kg CO₂e; the tooltip gives the energy and the average power. scale is then read in kW and g CO₂e per hour |
| Point budget (spec §10.3) | Above 750 intervals, the generated missing ones included, the chart draws nothing, builds no table, and says For mange punkter (2.016, højst 750): vælg en kortere periode eller en grovere opløsning. The count is taken before any interval is built, so a far larger window costs no more than sorting its rows; the data is never thinned |
| Axis | Hour labels every 1, 2, 3, 6 or 12 hours, whichever fits; the repeated hour is 02A and 02B, the 23-hour day has no 02. Where not every hour has a label (a week, a month), the two repeated hours share one label 02A/02B centred over both, placed before the other hour labels. Day labels with the weekday where they fit, else every 2nd, 7th … day. The 23- and 25-hour days are named under the axis (23 timer, 25 timer). Day boundaries at the local midnights; below 16 px a day, only at the labelled days |
| Labels | The largest value of each tier; the factor's smallest as well. A label stays at its interval's x; at the plot's edge its text runs inward from there (anchored at start or end) rather than moving over the next interval. No value axis: a light grid with two to four labelled levels in every tier (B16b); the factor's smallest label stands above its point when there is no room below, never on the axis line |
| Interaction | One hit area for the whole chart: the pointer's x is turned into an instant and looked up. Focus it (a role="img" that carries the keys' name) and use ←, →, Home, End; Escape closes; a live region says the active interval's time and the tooltip's rows. The tooltip: tir. 3.11.2026 kl. 22:00–23:00, each tier's value and unit, the quality and the factor's state. The active interval is kept by its start instant: when new data, window or grain arrives it moves to the interval that holds that instant, or closes when there is none |
| Table view | Vis som tabel: one row per interval, the chart's numbers at one more decimal, the states in words with their swatches |
| Phone | Columns need 6 px per interval; a narrower frame scrolls sideways inside a focusable region, the page never does |
Every number, date and clock time comes from src/core/format.ts (formatHourLabel, formatHours,
formatIntervalWhen, chooseUnitScaling, formatDayMonth, formatNumber); the chart formats nothing itself.
Its Danish words are in DENSE_STRINGS.
A 745-point month renders as about 110 SVG elements; a week of hours as columns about 400.
Kilde: docs/dense-time-chart.md i løsningens
repository.