BalanceChart

Balance over time. Switch the range and the line morphs; drag across it and the figure follows with the change since the start. Finance.

Open playground
Total balance$24,120.98+$134.68 (0.56%)

About

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

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

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

<BalanceChart title="Total balance" periods={[{ label: "1W", data: week }, { label: "1M", data: month }]} />

Props 4

periods

One series per range. Any lengths; they are resampled so the line can morph.

{ label; data: number[] }[]
title

Label above the figure.

stringdefault "Balance"
currency

ISO currency code.

stringdefault "USD"
height

Chart height in px.

numberdefault 170