# Balance Tracker block

> Portfolio balance line chart with range tabs, high and low markers and a benchmark overlay

Daily account balance over 1M, 3M, YTD or 1Y: a morphing Recharts line with high and low markers, a Compare benchmark toggle, an average line, a line color picker, a full readout tooltip, stats and CSV export. ReUI Frame.

- Type: Pro block
- Category: [Line Chart](https://web.dev.reui.io/blocks/chart/line-chart.md)
- Page: https://web.dev.reui.io/blocks/chart/line-chart/chart-4
- MCP: `get_block("chart-4")`
- Built with: Badge, Button, Button Group, Chart, Color Picker, Dropdown Menu, Frame, Icon Tile, Spinner, Toggle, Toggle Group, Tooltip
- Installs with a ReUI Pro or Ultimate license; setup: https://web.dev.reui.io/docs/license-setup

## Best for

One account balance over a picked range with its high and low marked, against a rebased benchmark and the range average

## Agent notes

- Replace `buildYear` in data.ts with real daily closes; `rangeRows` rebases the benchmark index to each range's opening balance
- `LIVE_QUOTES` stands in for a quote feed: `refresh` waits `REFRESH_MS`, then swaps today's close for the next quote; call your API there
- The line colour comes from `ACCENT_SCOPE` and `accentStyle` on the Frame; keep both when moving `BalancePlot`, and edit `ACCENT_SWATCHES` for the picker

## When not to use

- Revenue over short 5 day to 1 month tabs with an Export button: use [Revenue Trend](https://web.dev.reui.io/blocks/chart/line-chart/chart-22.md) (`get_block("chart-22")`)
- Several platforms compared as separate strokes on one axis: use [Social Engagement](https://web.dev.reui.io/blocks/chart/line-chart/chart-23.md) (`get_block("chart-23")`)

## Third-party libraries

- Recharts v3: [API reference](https://recharts.github.io/en-US/api/), [docs](https://recharts.github.io/en-US/guide/getting-started/)
- Sonner v2: [API reference](https://sonner.emilkowal.ski/toast), [docs](https://sonner.emilkowal.ski/getting-started)

## Install

```bash
npx shadcn@latest add @reui/chart-4
```

## About Line Chart blocks

### When to use

- A balance, price or revenue trend as a single stroke with period tabs and a peak marker
- Several platforms or channels compared as separate strokes on one time axis
- Two measures on different scales plotted against left and right axes

### When not to use

- A trend that needs its volume emphasized with a filled region below it: use the [Area Chart blocks](https://web.dev.reui.io/blocks/chart/area-chart.md)
- Compact tiles where each figure carries a small trend of its own: use the [Sparkline blocks](https://web.dev.reui.io/blocks/chart/sparkline.md)

### Agent notes

- Series colors live in the `ChartContainer` config; chart-6 and chart-26 plot in a `ComposedChart` with an `Area`, the others in a `LineChart`

Every ReUI item has a twin like this one; the index is https://web.dev.reui.io/llms.txt. Agents with the ReUI MCP (https://web.dev.reui.io/docs/mcp) get the same guidance from the getters named above.
