Skip to content
quartiledocsv0.1
GitHub

LineChart

PreviewSVGPublishes selection

Shows how one or more measures change over a continuous dimension, usually time. Use it for trends; reach for a bar chart when the categories are discrete.

Playground

Daily active users
Sep 7 – Oct 6, 2026

Users from Sep 7 to Oct 6: up 9.2%, from 12,328 to 13,468. Low 10,039 on Sep 13; high 13,891 on Oct 5.

Daily active users
DateUsersPrevious
Sep 712,32811,475
Sep 812,28611,815
Sep 912,67111,868
Sep 1012,76511,932
Sep 1112,28011,449
Sep 1210,1939,710
Sep 1310,0399,331
Sep 1412,29011,754
Sep 1512,77011,729
Sep 1613,06011,661
Sep 1713,19811,857
Sep 1812,75412,166
Sep 1910,3479,839
Sep 2010,0809,640
Sep 2112,69912,022
Sep 2213,10611,697
Sep 2312,64111,907
Sep 2412,72112,248
Sep 2513,56312,202
Sep 2610,1949,824
Sep 2710,5229,569
Sep 2813,43612,288
Sep 2912,87111,809
Sep 3013,73812,659
Oct 113,08712,323
Oct 213,27511,944
Oct 310,90910,196
Oct 410,4769,675
Oct 513,89112,391
Oct 613,46812,451
curve
<LineChart
  data={daily}
  x="date"
  y="users"
  curve="monotone"
  area
  compare="users_previous"
  legend
/>

Installation

LineChart is exported from @quartile/react, alongside every other chart and component.

git clone https://github.com/zinnoberHaus/quartile

Not on npm yet: build the package from the clone as described in Installation. The preview API may change before publication.

Usage

Pass rows and name the fields. Types, formats and axis labels come from the data's schema, so most charts need three props. Rows that share an x value are summed, so raw rows work.

import { LineChart } from '@quartile/react';

// One precomputed distinct-user count per day.
type DailyUsers = { date: string; users: number };

export function ActiveUsers({ rows }: { rows: DailyUsers[] }) {
  return <LineChart data={rows} x="date" y="users" />;
}
Inside a <Selection>, LineChart filters itself by every predicate except its own brush, and with brush publishes the dragged range as a between predicate on x. See Linked selections.

Props

PropTypeDefaultDescription
datarequiredDataInput<R>—Rows to plot, or a dataset with a schema attached.
xrequiredkeyof R & string—Continuous field for the horizontal axis. Dates are detected from the schema.
yrequired(keyof R & string) | (keyof R & string)[]—One or more measures. Pass an array for multiple series.
colorkeyof R & string—Splits rows into series by a categorical field.
comparekeyof R & string—Field holding comparison values, drawn as a dashed series with deltas in the tooltip.
compareLabelstring'Previous'Label for the comparison series.
curve'linear' | 'monotone' | 'step'Curve'monotone'Interpolation between points. Monotone never overshoots the data.
areabooleanfalseFills below the line with a fading gradient.
pointsboolean | 'hover''hover'Marks every point, or only the hovered one.
brushbooleanfalseLets readers select a range and publishes it to the nearest Selection.
formatFormatter—Formats the y axis and tooltip values. Defaults to the field's schema format.
xFormatFormatter—Formats the x axis. Defaults to the field's schema format.
annotations{ x: unknown; label: string }[]—Vertical markers with a short label, e.g. a pricing change.
legendboolean—Shows a legend above the plot. Defaults to true when there is more than one series.
idstring—Publisher id for the selection. Defaults to a generated id.
selectionstring | false—Selection to read from and publish to. Defaults to the nearest; false opts out.
onSelect(predicate: Predicate | null) => void—Called when a brush or keyboard selection changes.
Frame and state props shared with the charts (11) · ChartBaseProps, ChartStateProps
PropTypeDefaultDescription
heightnumber240Plot height in px. Width always fills the container.
classNamestring——
styleCSSProperties——
aria-labelstring—Accessible name. A summary of the data is generated and rendered as hidden text inside the figure.
view'chart' | 'table'—table renders the same data as a table, with the same formats, at the chart's size. Large lazy tables expose a data-view control rather than mounting every hidden row.
tooltipNotestring—Plain-text context shown with tooltips and included in the accessible chart description.
loadingboolean | string—Shows the loading state at the chart's size, so the layout never jumps.
errorboolean | string | Error | null—Shows the error state. A string or Error becomes the message.
errorCodestring—Shown in the error state; copyable for support.
onRetry() => void——
empty{ title?: string; description?: string; action?: ReactNode }—Title and description for the empty state. Shown when there are no rows.

Accessibility

Keyboard
Tab into the chart, ← → between points, Home and End to jump. With brush, Enter or Space selects the focused point. The cursor starts on keyboard focus, not on a click.
Screen readers
An auto-written summary per series: range, trend, low and high, as hidden text inside the figure. The focused point is announced as you move.
Table fallback
Screen readers always get a table of the plotted values with the same formats. view="table" shows it at the chart's size.
Report an issueBuilt Oct 21, 2026