Responsive SVG time-series chart with a primary series, optional secondary series, standalone alert markers, named threshold lines, a hover tooltip, and legend toggles. The route reference at the bottom of this page documents the full prop and data-point API.
Single Series + Named Thresholds + Alert Points
Hover near the alert markers or threshold lines in this sample. The tooltip now shows multiple named thresholds and alert details without forcing those values into the primary data series.
CwLineChart is the low-level time-series chart for sensor history. Pass a primary series, optionally add a secondary right-axis series, and the component handles responsive sizing, auto-scaled axes, a hover crosshair, standalone alert markers, named thresholds, and legend toggles.
How to think about it
Start with the primary series`data` is the only required prop. Each point needs a `timestamp` and `value`, and you can still attach legacy `alert` metadata directly to a point when that is the simplest shape.
Add `secondaryData` only for different unitsWhen the second series needs its own scale, pass `secondaryData` and the matching `secondaryLabel` / `secondaryUnit`. The chart automatically adds a right Y-axis and dashed line.
Prefer `alertPoints` for explicit markersUse `alertPoints` when alerts should be managed separately from the primary data array. The chart still supports the older `data[].alert` shorthand for one-off cases.
Use `thresholds` for named horizontal rules`thresholds` is the preferred API for multiple named lines. Hovering near a threshold shows its name and value in the tooltip. The old `threshold` prop remains as a single-line shorthand.
Adjust height to the surfaceUse taller charts for analysis views and shorter ones for cards. Set `showGrid={false}` when the surrounding layout already gives enough visual structure.
Props and data shape
CwLineChart has no slots or callbacks. The hover tooltip, crosshair, responsive width observer, and legend toggles are built in.
API
Type
Details
dataRequired
CwLineChartDataPoint[]
Primary time-series data rendered against the left Y-axis.
data[].timestamp
string | Date
Point timestamp used for X-axis placement and tooltip formatting.
data[].value
number
Numeric reading plotted on the primary line and left Y-axis.
data[].alert
CwLineChartAlert
Legacy single-alert shorthand attached directly to one primary data point.
data[].alerts
CwLineChartAlert[]
Optional multiple alerts associated with a single primary data point.
alertPoints
Default: []
CwLineChartAlertPoint[]
Optional standalone alert markers. Use this when alerts are managed separately from the main data series.
secondaryData
Default: []
CwLineChartSecondaryDataPoint[]
Optional comparison series for the right Y-axis. Each point uses the same `timestamp` + `value` shape without alerts.
threshold
number
Legacy single-threshold shorthand for the primary axis. Ignored when `thresholds` is provided.
thresholds
Default: []
CwLineChartThreshold[]
Named threshold lines drawn on the primary axis. Hovering near a line shows its name and value in the tooltip.
primaryLabel
Default: Value
string
Left-axis label and primary legend label.
secondaryLabel
Default: Secondary
string
Right-axis label and secondary legend label.
primaryUnit
Default: ''
string
Unit suffix used in the primary tooltip and threshold label.
secondaryUnit
Default: ''
string
Unit suffix used in the secondary tooltip.
height
Default: 300
number
Chart height in pixels.
showGrid
Default: true
boolean
Shows or hides the horizontal and vertical guide lines.
class
Default: ''
string
Optional class forwarded to the chart wrapper element.
Copy-paste examples
These snippets intentionally show the full public API surface the live demo relies on.
Named thresholds and standalone alert points
This is the preferred setup when alert markers and threshold rules come from separate telemetry or rule data.
Named thresholds and standalone alert pointsCopy code