Line chart

SVG line path from a data array. Renders inside ChartRoot. Supports custom y-accessors for multi-series.

Primitive: ChartLine

Interactive demo

Usage

import { ChartRoot } from '@ramtt/charts'
import { ChartLine } from '@ramtt/charts'
import { ChartAxisY } from '@ramtt/charts'

<ChartRoot data={data} height={200}>
  <ChartLine className="stroke-[var(--n1150)] stroke-[1.5]" />
  <ChartAxisY />
</ChartRoot>

Props

PropTypeDefaultDescription
datareadonly number[]Override ChartRoot data for this line
classNamestringSVG path class (stroke color, width)
yDomain[number, number]Override Y domain
yAccessor(d, i) => numberCustom Y value accessor