Skip to content

XYGraph

Data sets of (x, y) pairs with arbitrary spacing: characteristic curves, scatter plots (IND-115).

XYGraph, light theme XYGraph, dark theme

Recipes and plant structure · Widget catalog · API reference · schema xygraph.schema.json

Example

The traits of the picture above:

ai.XYGraph(
    label="XYGraph (pump curve)",
    x_min=0,
    y_min=0,
    cursors=[{"x": 75, "name": "C1", "color": ""}],
    x_unit="m³/h",
    unit="m",
    size=(420, 240),
)

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 [480,300] host [width, height] in CSS pixels.
value object {} host Number of data sets and of points {sets, points}, written by the host with each data message.
series array of object [] host Data sets {name, color, style, width}, drawn in order. A set whose data have not arrived is not drawn; data of a name not listed here are dropped.
x_min number or null null host X range; null: from the data.
x_max number or null null host A number, or null when not set.
y_min number or null null host Y range; null: from the data.
y_max number or null null host A number, or null when not set.
show_legend boolean true host
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 (Python does).
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.