Skip to main content
AreaChart
@coinbase/cds-web@9.0.2
A chart component that displays data as filled areas beneath lines. Ideal for showing cumulative values, stacked data, or emphasizing volume over time.
import { AreaChart } from '@coinbase/cds-web/visualizations/chart'
Peer dependencies
  • framer-motion: ^10.18.0

AreaChart is a wrapper for CartesianChart that has some unique features over LineChart, such as the ability to stack areas on top of each other and a default value-axis minimum that follows the baseline (0 when baseline is not set). Charts are built using SVGs.

Basics​

The only prop required is series, which takes an array of series objects. Each series object needs an id and a data array of numbers.

Loading...

Data​

Positive and Negative​

Area grows from the baseline to each value, allowing for both positive and negative data to be shown. Also, you can set baseline to any value you'd like.

Loading...

Range​

You can pass in [min, max] tuples as data points to render an area that span a range of values.

Loading...

Stacking​

You can use the stacked prop to stack all areas on top of each other. You can also use the stackId prop on a series to create different stack groups. See CartesianChart for more info on stacking.

Loading...

Styling​

Areas​

You can have different area styles for each series.

Loading...

Axes​

Using showXAxis and showYAxis allows you to display the axes. For more information, such as adjusting domain and range, see XAxis and YAxis.

Loading...

Gradient​

You can build threshold-based gradients with hard transitions by reusing stop offsets.

Loading...

Composed Examples​

Custom Baseline​

You can combine a custom baseline with a scrubber label that shows both price and date.

Loading...

Is this page useful?

Coinbase Design is an open-source, adaptable system of guidelines, components, and tools that aid the best practices of user interface design for crypto products.