Area Chart

A versatile area chart component for visualizing trends and volumes over time. Supports gradient fills, stacked areas, multiple series, and smooth animations.

CLI Installation
Gradient & Solid Fill
Stacked Areas
Multiple Series
Curve Interpolation
Interactive Tooltips
Grid Lines & Y-Axis
Keyboard Accessible
Performance Optimized
TypeScript
Zero Dependencies

Basic Example

A simple area chart showing weekly website traffic with gradient fill and interactive points

Loading...
Selected: Click a point to select
Curve:

Installation

Get started with the AreaChart component in just a few steps.

Quick Install
bash
npx mario-charts@latest add area-chart
Zero Lock-in Philosophy
The component is fully yours to own, modify, and customize.

Examples

Explore different configurations and use cases for the AreaChart component.

Multiple Series

Revenue, costs, and profit visualized as overlapping areas with an interactive legend

Loading...

Stacked Areas

Areas stacked on top of each other for cumulative visualization of revenue and costs

Loading...

Curve Types

Four interpolation modes for different data characteristics

linear

curve="linear"

Loading...

monotone

curve="monotone"

Loading...

natural

curve="natural"

Loading...

step

curve="step"

Loading...

Fill Styles

Gradient fill fades to transparent, solid fill uses a flat color with adjustable opacity

Gradient

gradient=true (default)

Loading...

Solid

gradient=false areaOpacity=0.4

Loading...

Chart States

Built-in loading, error, and empty states

Loading

Error

Chart Error
Network connection failed

Empty

No Data
There's no data to display

API Reference

Complete TypeScript interface with all available props and configurations.

PropTypeDefaultDescription
datarequired
readonly T[]Array of data objects to display in the chart
xrequired
keyof TKey from data object to use for x-axis labels
yrequired
keyof T | readonly (keyof T)[]Key(s) from data object to use for y-axis values. Single key for one area, array for multiple series
colors
readonly string[]DEFAULT_COLORSArray of colors to use for areas (cycles through for multiple series)
height
number300Height of the chart in pixels
areaOpacity
number0.3Fill opacity for the area (0 to 1)
gradient
booleantrueUse gradient fill from top to bottom instead of solid color
stacked
booleanfalseStack areas on top of each other for cumulative visualization
strokeWidth
number1.5Width of the area border line in pixels
curve
'linear' | 'monotone' | 'natural' | 'step''monotone'Type of curve interpolation for the area boundary
showDots
booleanfalseShow circle markers at each data point
showGrid
booleanfalseShow horizontal grid lines and Y-axis tick labels
gridStyle
'solid' | 'dashed' | 'dotted''dashed'Style of the grid lines when showGrid is enabled
showLegend
booleanfalseShow legend below the chart for multi-series data
connectNulls
booleantrueWhether to connect points across null/missing values
loading
booleanfalseShow loading state with animated skeleton
error
string | nullnullError message to display
animation
booleantrueEnable entrance animations
onPointClick
(data: T, index: number, series?: string) => voidCallback fired when a data point is clicked
tooltipRenderer
(data: AreaChartTooltipData<T>) => React.ReactNodeCustom tooltip render function for full control over tooltip content
className
stringAdditional CSS classes to apply to the container