Skip to main content

Line Chart

Type: line_chart • Category: visualization

Description

Store time-value points (list) for line chart widget

Parameters

NameTypeDescriptionRequiredDefault
widgetIdstringno
rowsExprstringExpr -> list[dict] (each dict: ts/value or multiple numeric fields)no
timestampstringno
fieldsfields_multiSubset of numeric field names to include (auto multi-series). Leave empty for all.no
shadebooleanFill area under lines (shading).notrue
limitnumberno500

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

  • widgetIdstring
    Identifier of the target line‑chart widget where the data will be displayed.

  • rowsExprstring (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.

  • timestampstring
    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.

  • fieldsfields_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.

  • shadeboolean (default: true)
    When true, the area under each line is filled, giving a shaded appearance. Set to false for a plain line‑only view.

  • limitnumber (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 recent limit 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:

  • widgetIdmarket_chart_01
  • rowsExprfetch_market_rows()(returns the list of dictionaries shown above)
  • timestampts
  • fieldsprice, volume(or leave empty to include both automatically)
  • shadetrue
  • limit200

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.