Repository navigation
Note
For Android, the minimum SDK version has been raised from 23 to 24, in line with AndroidX.
Overview
- breaking changes: none1
- addressed: #660, #736, #1053, #1601, #1614, #1648
- external contributors: @adrcotfas, @davols, @jonasborggren, @mkx173, @shayann07
Changes
- Added grouped stacked columns.
ColumnCartesianLayer.StackKeyProviderassigns aColumnCartesianLayer’s series to stacks: Series whosegetStackKeyresults are equal (as determined byequals) share a stack, and the stacks are grouped side by side. Each stack is as wide as its widest column, and in each stack, positive and negative values accumulate separately.StackKeyProvider.GroupedandStackKeyProvider.Stackedreproduce the previous behavior of giving every series a column of its own and of stacking all series into one column. - Added
stackKeyProviderandstackSpacingparameters toColumnCartesianLayerandrememberColumnCartesianLayer, and renamedcolumnCollectionSpacingtogroupSpacing, which now spaces groups rather than single columns.mergeModeandColumnCartesianLayer.MergeMode, includingMergeMode.GroupedandMergeMode.Stacked, are deprecated in favor ofstackKeyProviderandstackSpacing. Deprecated constructors,copyoverloads, andrememberColumnCartesianLayeroverloads cover the old parameters. - Added drag-to-rotate for pie charts.
rememberPieRotationStatecreates aPieRotationState, which houses a pie chart’s rotation and exposes the currentangle, and bothPieChartHostoverloads gain arotationStateparameter. Rotation is off by default and is turned on viarotationEnabled. Tangential drags rotate the pie and fling on release; radial drags are left to the parent scroll. - Removed
PieChart.startAngleand thestartAngleparameters ofrememberPieChartandPieChart.copy, as the angle now lives solely inPieRotationState. PassrememberPieRotationState(initialRotation = …)toPieChartHostinstead. Host-less rendering, includingrenderToImageBitmap, continues to use −90°. - Fixed number formatting, which is now consistent across platforms. The digits are computed arithmetically rather than parsed from the platform-specific output of
Double.toString: Whole numbers no longer lose their trailing zeros on Kotlin/JS (100 was shown as “1”), values from 10⁷ on no longer pick up the JVM’s scientific notation (1e10 was shown as “1.0E1”), and binary representation errors no longer truncate values such as 0.29 to “0.28.” Thousands separators are no longer inserted after the minus sign (“−,200”), and negative values that round to zero are no longer shown as “−0.” Values are now rounded half away from zero rather than truncated, so 1.239 is shown as “1.24” rather than “1.23.” This affectsCartesianValueFormatter.decimal,CartesianValueFormatter.yPercent,DefaultCartesianMarker.ValueFormatter.default,PieValueFormatter.Value, and the default labels ofHorizontalLineandHorizontalBox. - Fixed
CartesianValueFormatter.yPercent, which divided values bymaxYwithout multiplying the quotients by 100, so half ofmaxYwas shown as “0.5%” rather than “50%.” - Fixed the sideways jump at the end of a pinch.
VicoZoomStatenow applies a zoom factor and its anchoring scroll compensation atomically, so neither can be separated from the other or cancelled in between, and the compensation is no longer dropped while a scroll is in progress. Relatedly, the maximum scroll value is no longer computed for the wrong zoom factor within a frame, zoom anchoring is now correct in RTL layouts,initialZoomis no longer permanently suppressed by a pinch clamped atminZoom,zoom(Zoom)andanimateZoomnow share an anchor, and a replacedVicoScrollStateis now picked up even when the chart has no area. - Fixed the residual hop at the end of a pinch, where the lifting of the first finger could seed
scrollable’s touch-slop detection with that finger’s entire travel and start a drag. Pinch gestures now consume every pointer change. - Fixed
CartesianChartHostandCartesianChartModelProducerlosing each other shortly after composition. Registration ran inside awithContextchild job that completed as soon as the update receiver had been launched, so the matching unregistration could run while the chart was still composed. Since registration lands onDispatchers.Default, an unregistration that won the race removed the live receiver, and every subsequent transaction was silently dropped, leaving the chart empty or stuck on stale data. This was most likely under CPU load. Registration now lasts for as long as the chart is in the composition, and unregistration is tied to the chart’s coroutine scope, which also covers previews abandoned before their effects are applied. - Prevented a
ConcurrentModificationExceptionfromCartesianChartModelProducer.updatewhen a chart was disposed during an update. The update receivers are now held in an immutable map behind an atomic reference, so registration and unregistration can’t drop a concurrent update’s changes, or vice versa. - Fixed the restoration of cached data when a
CartesianChart’s identity changes. The restored model is now recomputed along with the rest of the chart’s state, rather than being retained from the previous chart. - Fixed the hole in single-slice donut charts, which was filled in when a slice spanned the full circle, as the slice path’s fill type was lost when the path was copied for drawing.
-
Excluding pie charts, which are experimental. (They’ll remain available, but breaking changes are more likely.) ↩