LineChart

Multi-series lines that draw in. A guide scrubs across and the legend chips toggle lines on a spring. Charts.

Open playground
JanMarMayJul

About

LineChart is a React component in the Charts category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { LineChart } from "@ashutoshswamy/smoui" and set series, labels, prefix among its 4 props.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { LineChart } from "@ashutoshswamy/smoui";

<LineChart
  prefix="$"
  labels={["Jan", "Feb", "Mar"]}
  series={[{ name: "Revenue", data: [1240, 1810, 1520] }, { name: "Costs", data: [900, 1100, 1250] }]}
/>

Props 4

series

Up to 3 lines.

{ name: string; data: number[] }[]
labels

One per point.

string[]
prefix / suffix

Wrap values, or pass `format`.

string
height

Plot height in px.

numberdefault 200