Chart Types

Line Charts

Plot time-series or continuous data with layered lines, gradients, and dual-axis support. Lines register with the chart context, enabling shared tooltips, legends, and crosshairs.

Example

The demo shows multiple temperature series on the primary axis. Combine this with regions, annotations, and brushing for richer monitoring views.

Usage

<Chart.Root data={data} height={360}>
  <Chart.XAxis label="Time" />
  <Chart.YAxis label="Temperature (°F)" />
  <Chart.LineSeries
    x="timestamp"
    y="supply_temp"
    name="Supply"
    color="var(--ambient-data-series-5)"
    showArea
  />
  <Chart.LineSeries
    x="timestamp"
    y="return_temp"
    name="Return"
    color="var(--ambient-data-series-2)"
  />
  <Chart.Legend />
</Chart.Root>

Props

Chart.LineSeries
PropTypeDefaultDescription
dataChartDataPoint[]Root dataOptional override for the series dataset. Falls back to `Chart.Root` `data`.
xstringField name used for the x-domain (dates or numbers).
ystringField name used for y-values.
namestringSeries labelDisplay name surfaced in the legend and tooltip. Provide it for multi-series charts.
colorstringTheme line tokenHex or CSS color. Falls back to the sequential palette in `chart-constants.ts`.
axisstring`"y"`Optional secondary axis name. Use with a matching `<Chart.YAxis name="..." />`.
strokeWidthnumber2Line weight in pixels.
curveCurveType`"linear"`Observable Plot curve interpolation. Common values: `linear`, `step`, `natural`.
strokeDasharraystringDash pattern string (`"4,2"`) for differentiating forecast vs. actual series.
showAreabooleanfalseRender a filled gradient beneath the line. Useful for emphasising magnitude.
areaOpacitynumber0.1Opacity applied to the generated gradient when `showArea` is enabled.
unitstringOptional unit suffix appended to tooltip values (°F, kWh, etc.).

Tips for multi-series charts

  • Use `axis` to bind a series to named right-side axes when magnitudes differ.
  • Provide `unit` strings so the tooltip can format and suffix values consistently.
  • Toggle `showArea` on a single series to create contextual emphasis without overcrowding the legend.