Migration Guide
This page summarizes snapshot breaking changes and how to migrate call sites safely. Use the module sections below to jump directly to impacted APIs.
charts-core
Do I need to update call sites?
- No, if you already call
ChartViewDefaults.style(...)and keep the default square chart area. - Yes, if you want a non-square chart area; pass the new
modifierChartargument.
What changed
ChartViewDefaults.style(...)now includesmodifierChart: Modifier(defaultModifier.aspectRatio(1f)) and threads it throughChartViewStyle.
Migration (only if required)
// Before
val chartViewStyle = ChartViewDefaults.style()
// After
val chartViewStyle = ChartViewDefaults.style(
modifierChart = Modifier.aspectRatio(16f / 9f),
)- Recommended: Prefer named arguments when calling style factory functions.
charts-bar
Do I need to update call sites?
- No, if you call
BarChartDefaults.style(...)with named arguments only. - Yes, if you pass
BarChartDefaults.style(...)arguments positionally afterbarColor, or if you call internalvalidateBarData(...)directly.
What changed
BarChartDefaults.style(...)addsbarColors: List<Color> = emptyList()immediately afterbarColor.validateBarData(...)now acceptscolorsSizeto validatebarColorslength against data points.
Migration (only if required)
// Before
val barStyle = BarChartDefaults.style(
MaterialTheme.colorScheme.primary,
0.4f,
10.dp,
)
// After
val barStyle = BarChartDefaults.style(
barColor = MaterialTheme.colorScheme.primary,
barAlpha = 0.4f,
space = 10.dp,
)- Recommended: Use named arguments for
BarChartDefaults.style(...)to stay resilient to future parameter additions.
charts-pie
Do I need to update call sites?
- No, if you never passed
innerPaddingtoPieChartDefaults.style(...). - Yes, if you previously passed
innerPadding; move that value intochartViewStyle.
What changed
PieChartDefaults.style(...)removedinnerPadding.- Pie content padding now comes from
chartViewStyle.innerPadding.
Migration (only if required)
// Before
val pieStyle = PieChartDefaults.style(
innerPadding = 24.dp,
)
// After
val pieStyle = PieChartDefaults.style(
chartViewStyle = ChartViewDefaults.style(innerPadding = 24.dp),
)- Recommended: Keep pie container spacing and chart-view spacing aligned through one
ChartViewStyleinstance.