Version that worked
react-native-chart-kit 6.12.3
Version that regressed
7.0.1
Component
LineChart (legacy root import)
Legacy props and data
<LineChart
data={{ labels: [], datasets: [{ data: [10, 20, 15, 30, 25, 40] }] }}
width={400}
height={125}
style={{ paddingRight: 10 }}
chartConfig={{ propsForDots: { r: "6" } }}
bezier
transparent
/>
What happens
In v6, dot i was rendered at:
cx = paddingRight + i * (width - paddingRight) / data.length
In v7, the same legacy LineChart renders it at:
cx = paddingRight + i * (chartWidth - paddingRight) / (data.length - 1)
Two changes cause this:
getXMaxValues returns Math.max(data.length - 1, 1) in v7 (src/charts/line/LineChart.tsx), where v6 returned data.length. This spreads the points across the full width, shifting every point except the first.
- A new
getChartRightPadding subtracts dot radius (min 4px) from the drawing width.
With the sample above (6 points, width 400, paddingRight 10), v6 spaced dots 65px apart; v7 spaces them ~76.8px apart — the last dot shifts ~59px. Any app that overlays custom markers/labels on the legacy chart using the v6 formula (a common workaround since the chart exposes no point positions) gets misaligned overlays.
Before and after screenshots
Will be added in a follow-up comment.
Did you try compatibility props?
Not available for this chart
Expected compatibility behavior
The migration docs (docs/migration/from-v1.md) say: "Keep migrated charts on the legacy package path when they rely on old spacing during a transition." So we expect the legacy root import to keep v6's exact point positions. The new spreading behavior may be nicer as a default, but it belongs to the v2 API — or behind an opt-in prop — not a silent change in the compat layer.
Additional notes
No warnings or errors — the chart renders fine, only positions changed. This blocks upgrading to v7 for us, since our screen overlays interactive markers on the data points.
Version that worked
react-native-chart-kit 6.12.3
Version that regressed
7.0.1
Component
LineChart (legacy root import)
Legacy props and data
What happens
In v6, dot
iwas rendered at:In v7, the same legacy
LineChartrenders it at:Two changes cause this:
getXMaxValuesreturnsMath.max(data.length - 1, 1)in v7 (src/charts/line/LineChart.tsx), where v6 returneddata.length. This spreads the points across the full width, shifting every point except the first.getChartRightPaddingsubtracts dot radius (min 4px) from the drawing width.With the sample above (6 points, width 400, paddingRight 10), v6 spaced dots 65px apart; v7 spaces them ~76.8px apart — the last dot shifts ~59px. Any app that overlays custom markers/labels on the legacy chart using the v6 formula (a common workaround since the chart exposes no point positions) gets misaligned overlays.
Before and after screenshots
Will be added in a follow-up comment.
Did you try compatibility props?
Not available for this chart
Expected compatibility behavior
The migration docs (
docs/migration/from-v1.md) say: "Keep migrated charts on the legacy package path when they rely on old spacing during a transition." So we expect the legacy root import to keep v6's exact point positions. The new spreading behavior may be nicer as a default, but it belongs to the v2 API — or behind an opt-in prop — not a silent change in the compat layer.Additional notes
No warnings or errors — the chart renders fine, only positions changed. This blocks upgrading to v7 for us, since our screen overlays interactive markers on the data points.