React Chart - Stacked Series

The Chart component can collect line, spline, area and bar series in stacks. Stacked series require the Stack plugin.

Basic Setup

Add the Stack plugin to draw several bar series side-by-side as shown in the following example:

Also, specify the stacks property to draw series one under another:

Specify Series Order and Offset

The Stack plugin allows you to customize the series order and offset. In the following example, a stacked area series is used to create a streamgraph. Order and offset values are calculated by calling the d3-shape library. Then, these values are passed to the Stack plugin’s order and offset properties.