AreaChart
Draws itself in. A guide, dot and tooltip follow the pointer on springs. Charts.
Open playgroundJul$3,340
About
AreaChart 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 { AreaChart } from "@ashutoshswamy/smoui" and set data, height, prefix among its 4 props.
Install
npm i @ashutoshswamy/smouiUsage
import { AreaChart } from "@ashutoshswamy/smoui";
<AreaChart
data={[{ label: "Jan", value: 1240 }, { label: "Feb", value: 1810 }]}
prefix="$"
/>Props 4
- data
Points. Needs at least 2.
{ label: string; value: number }[]- height
Plot height in px. Width fills the parent.
numberdefault200- prefix / suffix
Wrap the value, e.g. prefix="$". Or pass `format` as a function.
string- label
Accessible description. Arrow keys move the tooltip.
string
More charts components
- BarChartBars grow in a wave. The pointed bar lights up and its value pops above it.
- BulletChartProgress against a goal. The bar fills on a spring, a tick marks the target, and rows that beat it turn solid.
- BumpChartWho was ahead of whom, step by step. Lines swap places the way rankings do; point at one and it comes forward.
- ContributionGraphA calendar of days as squares, darker for busier ones. They pop in column by column; point at one for its date and count.
- DonutChartRing sweeps in segment by segment. Hover swells a segment and swaps the center.
- DumbbellChartBefore and after per row. The bar stretches between the dots, then the change lands in green or red.