TrendChart¶
Trend of named pens against wall-clock time, live or browsing the history (IND-070 .. IND-075).

Graphs, trends · Widget catalog · API reference ·
schema trendchart.schema.json
Example¶
The traits of the picture above:
ai.TrendChart(
label="TrendChart",
pens=[
{
"name": "LT-101",
"unit": "m",
"min": 0,
"max": 4,
"hi": 3,
"hihi": 3.5,
"setpoint": 2.2,
},
{"name": "FT-101", "unit": "L/s", "min": 0, "max": 60},
],
history=1000,
size=(520, 220),
)
The data of the picture (samples, history or drawing) is sent with the widget's methods, not as traits: see the widget catalog.
Traits¶
| Trait | Type | Default | Set by | Description |
|---|---|---|---|---|
size |
array | [560,260] |
host | [width, height] in CSS pixels. |
value |
object | {} |
host | Latest value of each pen, by pen name, written by the host with each append. |
pens |
array of object | [] |
host | Pens {name, unit, min, max, color, lolo, lo, hi, hihi, setpoint, format}. Python normalizes them (a string is a pen name, missing keys get their defaults) and rejects duplicate names, unknown keys and max <= min; the front end shows an invalid scale as 0 .. 100. |
span |
number | 600 |
host, widget | Seconds shown; set by the operator with the span selector. |
history |
integer | 10000 |
host | Samples kept per pen (IND-074). |
Common traits (14), shared with other widgets
| Trait | Type | Default | Set by | Description |
|---|---|---|---|---|
mode |
"control", "indicator" |
"indicator" |
host | "control": the user sets the value; "indicator": display only. |
label |
string | "" |
host | Plain text, never interpreted as HTML (SEC-002). |
disabled |
boolean | false |
host | Greyed out, input rejected. |
visible |
boolean | true |
host | |
tooltip |
string | "" |
host | Plain text shown on hover. |
style |
"modern", "classic", "system" |
"modern" |
host | |
theme |
"auto", "light", "dark", "system" |
"auto" |
host | "auto": the style decides; "system": the host page or the operating system (STYLE-007). |
skin |
object | {} |
host | Replaceable drawing parts: part name -> SVG source, sanitized (STYLE-005, STYLE-006). |
cursors |
array of object | [] |
host, widget | Cursors {x, name, color} (CHART-104). Dragged or typed by the operator, also on indicators; a host may complete a missing name as C |
cursor_values |
array of object | [] |
host | Readout of the cursors for the host program, {name, x, values}, computed by the host from its data. The front end draws its own readout and does not read this trait. |
annotations |
array of object | [] |
host | Text annotations {x, y, text, color} in data coordinates (CHART-105). |
export |
boolean | true |
host | Offer CSV, PNG and SVG downloads in the toolbar (CHART-107). |
x_unit |
string | "" |
host | |
unit |
string | "" |
host |
Set by: host, the program (Python, Julia, ...); widget, the user through the widget;
derived, computed from other traits by the host that owns the state, or by the widget.
See the trait contract.