DumbbellChart

Before and after per row. The bar stretches between the dots, then the change lands in green or red. Charts.

Open playground
Onboarding+26%
Checkout−7%
Search+24%
Settings+5%
BeforeAfter

About

DumbbellChart 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 { DumbbellChart } from "@ashutoshswamy/smoui" and set data, fromLabel, prefix.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

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

<DumbbellChart fromLabel="Q1" toLabel="Q2" data={[{ label: "Onboarding", from: 42, to: 68 }]} />

Props 3

data

One row each.

{ label; from; to }[]
fromLabel / toLabel

Legend names.

stringdefault "Before" / "After"
prefix / suffix

Wrap values, or pass `format`.

string