Skip to content

v3.4.0

Latest

Choose a tag to compare

@github-actions github-actions released this 28 Nov 16:07
· 1 commit to master since this release
d1aeb1a

Note

For Android, the minimum SDK version has been raised from 23 to 24, in line with AndroidX.

Overview

Changes

  • Added grouped stacked columns. ColumnCartesianLayer.StackKeyProvider assigns a ColumnCartesianLayer’s series to stacks: Series whose getStackKey results are equal (as determined by equals) 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.Grouped and StackKeyProvider.Stacked reproduce the previous behavior of giving every series a column of its own and of stacking all series into one column.
  • Added stackKeyProvider and stackSpacing parameters to ColumnCartesianLayer and rememberColumnCartesianLayer, and renamed columnCollectionSpacing to groupSpacing, which now spaces groups rather than single columns. mergeMode and ColumnCartesianLayer.MergeMode, including MergeMode.Grouped and MergeMode.Stacked, are deprecated in favor of stackKeyProvider and stackSpacing. Deprecated constructors, copy overloads, and rememberColumnCartesianLayer overloads cover the old parameters.
  • Added drag-to-rotate for pie charts. rememberPieRotationState creates a PieRotationState, which houses a pie chart’s rotation and exposes the current angle, and both PieChartHost overloads gain a rotationState parameter. Rotation is off by default and is turned on via rotationEnabled. Tangential drags rotate the pie and fling on release; radial drags are left to the parent scroll.
  • Removed PieChart.startAngle and the startAngle parameters of rememberPieChart and PieChart.copy, as the angle now lives solely in PieRotationState. Pass rememberPieRotationState(initialRotation = …) to PieChartHost instead. Host-less rendering, including renderToImageBitmap, 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 affects CartesianValueFormatter.decimal, CartesianValueFormatter.yPercent, DefaultCartesianMarker.ValueFormatter.default, PieValueFormatter.Value, and the default labels of HorizontalLine and HorizontalBox.
  • Fixed CartesianValueFormatter.yPercent, which divided values by maxY without multiplying the quotients by 100, so half of maxY was shown as “0.5%” rather than “50%.”
  • Fixed the sideways jump at the end of a pinch. VicoZoomState now 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, initialZoom is no longer permanently suppressed by a pinch clamped at minZoom, zoom(Zoom) and animateZoom now share an anchor, and a replaced VicoScrollState is 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 CartesianChartHost and CartesianChartModelProducer losing each other shortly after composition. Registration ran inside a withContext child 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 on Dispatchers.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 ConcurrentModificationException from CartesianChartModelProducer.update when 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.
  1. Excluding pie charts, which are experimental. (They’ll remain available, but breaking changes are more likely.) ↩