Skip to content

BarGraph

Group of aligned bars on a shared scale with per-bar alarm levels (IND-102).

BarGraph, light theme BarGraph, dark theme

Compact indicators · Widget catalog · API reference · schema bargraph.schema.json

Example

The traits of the picture above:

ai.BarGraph(
    value=[62, 64.5, 58, 83.1],
    label="BarGraph",
    bars=[
        {"label": "Z1", "normal_lo": 55, "normal_hi": 70},
        {"label": "Z2", "normal_lo": 55, "normal_hi": 70},
        {"label": "Z3", "normal_lo": 55, "normal_hi": 70},
        {"label": "Z4", "normal_lo": 55, "normal_hi": 70, "hi": 80, "hihi": 90},
    ],
    unit="°C",
    size=(240, 160),
)

Traits

Trait Type Default Set by Description
mode "control", "indicator" "indicator" host "control": the user sets the value; "indicator": display only.
size array [260,160] host [width, height] in CSS pixels.
value array of any [] host One value per bar.
bars array of any [] host Bars: a label, or {label, normal_lo, normal_hi, lolo, lo, hi, hihi}; only label is required, missing limits are null.
min number 0 host Lower end of the shared scale.
max number 100 host Upper end of the shared scale.
unit string "" host
format string "%.1f" host
deadband number 0 host Hysteresis of the bar alarm levels (ALARM-003).
alarm_levels array of enum [] derived Alarm level of each bar (a bar without a value is normal). Derived: by the host when it owns the state, otherwise by the front end (HOST-004).
Common traits (7), shared with other widgets
Trait Type Default Set by Description
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).

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.