Back to Chartview

Migration from 1.x

docs/wiki/07-migration-from-1x.md

2.0.01.1 KB
Original Source

Migration from 1.x

This page summarizes migration to 2.0.0.

Breaking change summary

  • Legacy chart view types are replaced by composable chart primitives.
  • Legacy mutating method chains are replaced by modifier APIs.
  • Interaction no longer requires @EnvironmentObject.

Replace these first

1.x2.x
LineChartViewLineChart
BarChartViewBarChart
PieChartViewPieChart
MultiLineChartViewmultiple LineChart layers

Replace common method chains

1.x2.x
.data(...).chartData(...)
.rangeX(...).chartXRange(...)
.rangeY(...).chartYRange(...)
.setAxisXLabels(...).chartXAxisLabels(...)
.setNumberOfHorizontalLines(...).chartGridLines(...)
.showChartMarks(...).chartLineMarks(...)

Interaction migration

Pick one:

  1. shared state:
    • .chartInteractionValue(ChartValue())
  2. callback style:
    • .chartSelectionHandler { event in ... }

Full mapping

See MIGRATION.md for complete type + method mapping.