Skip to main content

Area Chart

An area chart component built using Recharts v3. Supports stacked areas, gradients, and custom tooltips.

Installation

$ npx shadcn@latest add @orecus/area-chart
Registry:
@orecus/chart@orecus/color-utils@orecus/chart-utils@orecus/card

Component

Area Chart - Stacked

Showing total visitors for the last 7 days

With Reference Lines

Target and average thresholds

Props

PropTypeDefaultDescription
data*any[]—The data for the chart
categories*string[]—Keys in data to map to lines/areas
index*string—Key in data to use for x-axis
colorsThemeColor[]—Colors for each category
curveType'linear' | 'monotone' | 'step' | '...''monotone'Curve interpolation type
connectNullsbooleanfalseConnect area across null/undefined values
showDataLabelsbooleanfalseShow value labels directly on data points
showLegendbooleantrueShow chart legend
showGridLinesbooleantrueShow grid lines
actionsReactNode—Actions to display in the chart header
cardPropsCardProps—Props to pass to the underlying Card component
tooltipSortByValuebooleanfalseSort tooltip items by value (descending)
tooltipShowTotalbooleanfalseShow total in tooltip for multi-series
tooltipTotalLabelstring'Total'Label for the total row in tooltip
legendIndicator'square' | 'circle' | 'line''square'Shape of legend indicators
interactiveLegendbooleanfalseAllow clicking legend items to toggle series visibility
legendWrapbooleantrueAllow legend items to wrap to multiple lines
xAxisFormatter(value: string) => string—Formatter for x-axis tick labels and tooltip header
xAxisTickSVGProps | ReactElement | ((props) => ReactNode) | boolean—Custom tick rendering for the x-axis — overrides xAxisFormatter when set
yAxisFormatter(value: number) => string—Formatter for y-axis tick labels — falls back to valueFormatter
yAxisTickSVGProps | ReactElement | ((props) => ReactNode) | boolean—Custom tick rendering for the y-axis — overrides yAxisFormatter when set
referenceLinesChartReferenceLine[]—Reference lines (targets, thresholds, averages) rendered on the chart