Stacked and percent area charts were the most common Recharts examples Bklit couldn't draw. Now they're one prop away, along with dashed lines and real gaps where your data has holes.
Stacked areas
Pass stacked to AreaChart and each Area sits on top of the one before it, in the order you write them. Negative values stack down from zero, the same way stacked bars do. Tooltips and value labels still show each series' own value, while the hover dots and markers follow each layer's top edge.
Add stackOffset="expand" to turn it into a percent chart: every point is scaled so the stack fills 0–1. Pass formatValue to YAxis to show the axis as percentages.
Gaps for missing data
When a value is null, Line and Area join straight across it by default. Pass connectNulls={false} to leave a gap instead, so a missing day looks missing. The tooltip leaves out any series that has no value at the hovered point, instead of showing a 0 with a dot at the top of the chart.
This also fixes a bug: a missing value used to be drawn at the top edge of the chart. It's now skipped.
Dashed lines
Line now accepts strokeDasharray for the whole line, such as "5 5". Recharts code that set it used to be ignored silently. To dash only the last few points, keep using dashFromIndex.
Coming from Recharts, stackId, stackOffset="expand", connectNulls and strokeDasharray now map directly, and the migration skill knows it. Recharts leaves gaps by default, so the skill adds connectNulls={false} when it converts a chart with missing values.
See the area chart docs, the line chart docs and migrating from Recharts.
Originally published on the Bklit UI changelog. Bklit UI is an open-source library of React chart components for shadcn/ui and React Native.
Top comments (0)