Charts
Charts come in two forms. The presets — AreaChart, BarChart, ColumnChart, LineChart, PieChart, ScatterChart and SparkLine — cover the common cases. Underneath them sits a set of layer components that you compose inside a Chart container when you want something the presets don't do.
Structure
<Chart series={series}>
<ChartLegend />
<ChartYAxis side="right" />
<ChartGrid />
<ChartXAxis />
<ChartColumns />
<ChartLines seriesIndex={1} showPoints />
</Chart> Each layer reserves the space it needs from the Chart: adding a ChartXAxis claims a strip along the bottom, a ChartYAxis claims a strip on its side, a ChartLegend claims a strip for itself. The marks — columns, bars, lines, areas, points — draw only into the space left over, overlapping each other freely.
Layers
ChartXAxis/ChartYAxis— the axes. The y axis takes asideof"left"or"right", plus an optionallabelChartGrid— grid lines at each value step (hLines) and category slot (vLines)ChartLegend— a swatch and name per series, reserving"top"or"bottom"ChartColumns— vertical columns, grouped per slot, orstackedChartBars— horizontal bars, grouped per band, orstackedChartLines— connected lines, with optional points, orstackedChartArea— the region under a line, orstackedChartPoints— one circle per value
Every layer reads the same series (layers reference them by seriesIndex), and colors come from each series' own color or the palette.
Presets
Composing layers
The layered components can be mixed freely: columns with a line overlaid, an axis on either side, only a y axis with no x axis -- a preset like LineChart is just one such combination.