<talos-trend> is a moving window over a value stream. The polyline is the
recent history, so its slope is the rate of change — motion is the data
advancing, not a transition. The line colour bands on the current value
(nominal / warning / critical), reusing the same warn/crit threshold logic
as gauge and meter: colour is the state. Push a sample with el.push(v) or set
value and the window scrolls.
Default
<!-- data= seeds the window so a static trend draws a curve -->
<talos-trend data="30 34 28 40 38 46 42 50 44 52"></talos-trend>
With no warn/crit the line sits in the nominal band (green). data= is a
declarative series (comma/space separated) that fills the window; the window
holds cap samples (default 48); the newest sits at the right edge with a
dot, and the inline readout shows its rounded value. For live streams, call
el.push(v) instead of seeding data.
Banded — warn & crit thresholds
<talos-trend data="20 28 24 …40" warn="70" crit="90" unit="%"></talos-trend>
<talos-trend data="40 48 52 …78" warn="70" crit="90" unit="%"></talos-trend>
<talos-trend data="60 66 72 …95" warn="70" crit="90" unit="%"></talos-trend>
value >= warn trips warning (amber), value >= crit trips critical (red). The
band is read off the current value, so the whole line and readout snap colour
the instant the latest sample crosses — state never lags the data.
Inverted — low is bad
<talos-trend data="58 54 50 …18" warn="40" crit="20" invert></talos-trend>
invert flips the comparison: warning/critical trip as the value falls to/below
the threshold. For signals where danger is a low reading — frame rate, battery,
coolant reserve — so a dangerously low curve reads red.
Fill
<talos-trend data="40 46 52 …64" warn="70" crit="90" fill></talos-trend>
fill shades the area under the curve in the band colour at low opacity.
Labelled & sized
<talos-trend data="28 34 30 …74" warn="70" crit="90"
label="Throughput" unit="%" width="380" height="80" fill></talos-trend>
label adds an uppercase HUD caption above the line; unit is appended to the
readout. width/height size the SVG; cap sets how many samples the
window keeps (the data series above is well under it).
Live updates
Set value reactively (a MutationObserver appends each new value as a sample),
or for streams call the imperative push() per frame:
const el = document.querySelector("talos-trend");
setInterval(() => el.push(60 + Math.random() * 30), 250);
Read the curve twice while a system runs and the shape differs — there is no entrance animation; the line simply reflects the buffer.
Behaviour
Imperative API: el.push(value) appends a sample and scrolls the window —
preferred for streams over the value attribute path.
Attributes
Generated from custom-elements.json in the installed package.
Shared attributes (state, format, static…) behave as the
instrument contract describes.
| Attribute | Type | Default | Description |
|---|---|---|---|
data | string | — | initial series, comma/space separated. |
value | string | 0 | push this as the newest sample when it changes. |
cap | string | 48 | max samples kept in the window. |
points | string | — | deprecated alias of `cap` (warns once); in <talos-spark> `points` is the data series, so `cap` is the shared name. |
min | number | — | vertical domain; "auto" tracks the buffer. |
max | number | — | vertical domain; "auto" tracks the buffer. |
warn | number | — | band thresholds on the CURRENT value. |
crit | number | — | band thresholds on the CURRENT value. |
invert | boolean | — | low = bad (band trips as value FALLS) |
width | number | 220 | px. |
height | number | 60 | px. |
fill | boolean | — | if present, fills under the curve. |
label | string | — | caption. |
unit | string | — | appended to the inline readout. |
format | string | — | number | compact | percent | bytes | duration | currency; the readout's number format |
precision | string | — | fraction digits of the formatted value |
currency | string | — | ISO 4217 code when format=currency |
locale | string | — | BCP 47 locale for formatting; defaults to the page locale |
state | string | — | live | loading | stale | offline | unknown; sets data-state on the host |
updated-at | string | — | time of the last sample (ISO or epoch ms); drives the age caption |
stale-after | string | — | seconds after updated-at at which the element reads stale |
Properties and methods
| Member | Type | Description |
|---|---|---|
.value | number | null | The current reading; mirrors the `value` attribute (null = no data). |
push() | method | Append a sample and scroll the window. Preferred entry for streams. |
Events
| Event | Type | Description |
|---|---|---|
talos:band | CustomEvent<BandEventDetail> | Fired when the band changes (not on first render): detail { from, to, value }. Bubbles and is composed. |
CSS parts
::part(area), ::part(baseline), ::part(caption), ::part(dot), ::part(line), ::part(readout), ::part(svg)