When to use an interactive area chart
Use it for daily metrics where people want both the big picture and a close look at recent days.
- Website visitors by device
- Daily revenue or orders
- API requests by region
Data format
- Column 1 should be dates (2024-04-01); ranges then filter by days back from your newest date.
- Without dates, the range buttons keep the last 7 / 30 / 90 rows instead.
- Paste CSV, JSON from your API, TSV copied from Excel or Google Sheets, or a Markdown table. The generated component keeps your column names as its data keys.
Date,Desktop,Mobile
2024-04-01,320,189
2024-04-02,350,182
2024-04-03,336,187
2024-04-04,332,190
2024-04-05,368,181
2024-04-06,236,248[
{"date": "2024-04-01", "desktop": 320, "mobile": 189},
{"date": "2024-04-02", "desktop": 350, "mobile": 182},
{"date": "2024-04-03", "desktop": 336, "mobile": 187},
…
]Options
- Default range
- Which range button is selected when the chart loads.
- Brush
- Show or hide the drag-to-zoom brush under the chart.
- Tooltip
- Breakdown tooltip or shadcn's default.
How to add it to your project
- 1. Add the shadcn/ui chart component (it installs Recharts):
npx shadcn@latest add chart - 2. Paste your data above, pick the options, and copy the generated
chart.tsx. - 3. Save it in your project (e.g.
components/interactive-chart.tsx) and render<Chart />, or<Chart data={rows} />in Data as prop mode.
Interactive Area Chart FAQ
Each button keeps the rows within N days of the newest date in your data. It's plain React state in the generated component, with no date library.
Recharts' Brush: a small slider under the chart. Drag its handles to zoom into part of the selected range.
No. The range buttons are plain buttons styled with Tailwind, so only the shadcn chart component is required.