sabo/src/components/dashboard/chart-area-interactive.tsx
When to use
- Visualize KPIs and time-series within dashboard sections.
Usage
Styling tip
- Define series colors via
ChartContainerconfig for light/dark theme parity.
Key features
- Theme-aware colors: Define colors via
ChartConfigfor automatic light/dark mode support - Recharts integration: Uses Recharts components (AreaChart, LineChart, BarChart) inside
ChartContainer - Interactive: Supports tooltips, legends, and click handlers
- Responsive: Container queries adjust sizing based on available space
Steps
Create chart config
Define series with labels and colors. Colors can be simple strings or theme-specific objects:
Prepare data
Start with static arrays. Later, fetch from Supabase or your API. Ensure keys match
ChartConfig series names.Troubleshooting
- Colors not changing with theme
- Ensure you’re using
var(--color-{series})in Recharts components
- Ensure you’re using
- Chart not responsive
- Wrap in
ChartContainerwithclassNameheight/width
- Wrap in
- Data not showing
- Verify
dataKeyprops match your data object keys exactly
- Verify