Line Chart
Type:
line_chart
• Category:visualization
Description
Store time-value points (list) for line chart widget
Parameters
Name | Type | Description | Required | Default |
---|---|---|---|---|
widgetId | string | no | ||
rowsExpr | string | Expr -> list[dict] (each dict: ts/value or multiple numeric fields) | no | |
timestamp | string | no | ||
fields | fields_multi | Subset of numeric field names to include (auto multi-series). Leave empty for all. | no | |
shade | boolean | Fill area under lines (shading). | no | true |
limit | number | no | 500 |
Help
Overview
The Line Chart Data Worker prepares a series of time‑value points that can be consumed by a line‑chart widget, typically used to visualise financial market data. It receives raw rows, extracts timestamps and numeric fields, optionally limits the number of points, and can shade the area beneath each line for a richer visual presentation.
Inputs
-
widgetId –
string
Identifier of the target line‑chart widget where the data will be displayed. -
rowsExpr –
string
(expression) →list[dict]
An expression that evaluates to a list of dictionaries. Each dictionary must contain a timestamp (ts
) and one or more numeric values (e.g.,price
,volume
). The worker will iterate over this list to build the chart series. -
timestamp –
string
Name of the field in each row that holds the timestamp. The value should be parseable as an ISO‑8601 date/time or a Unix epoch. -
fields –
fields_multi
(list of strings)
Subset of numeric field names to include in the chart. When multiple fields are supplied, the widget automatically creates a multi‑series line chart. If left empty, all numeric fields present in the rows are used. -
shade –
boolean
(default:true
)
Whentrue
, the area under each line is filled, giving a shaded appearance. Set tofalse
for a plain line‑only view. -
limit –
number
(default:500
)
Maximum number of data points to retain per series. If the source contains more rows, the worker truncates the list to the most recentlimit
entries.
Minimal Example Usage
Assume you have a widget with ID market_chart_01
and a data source that yields rows like:
{ "ts": "2024-10-15T09:30:00Z", "price": 102.5, "volume": 1500 }
{ "ts": "2024-10-15T09:31:00Z", "price": 103.0, "volume": 1580 }
To feed this data into the line‑chart worker, you could configure the inputs as follows:
- widgetId →
market_chart_01
- rowsExpr →
fetch_market_rows()
(returns the list of dictionaries shown above) - timestamp →
ts
- fields →
price, volume
(or leave empty to include both automatically) - shade →
true
- limit →
200
With this configuration the worker will produce up to 200 time‑value points for each selected field, apply shading beneath the lines, and push the series to the widget identified by market_chart_01
.