v2.1.0
This release is effectively identical to version 2.1.0-beta.2
. The following compares versions 2.1.0
and 2.0.0
.
Warning
The old, pre-1.6.2
Maven Central coordinates are being discontinued. Those using them will receive deprecation warnings.
Overview
- breaking changes: minor
- addressed: #353, #805
- external contributors: @L-Andrade
core
- Various performance-related optimizations have been made.
DefaultCartesianMarker.LabelPosition.BelowPoint
has been introduced. This positions the label below the bottommost marked point.- The default dash and gap lengths for
LineCartesianLayer.LineStroke.Dashed
have been updated. - The host and
Transaction
ExtraStore
s have been decoupled: extras added viaCartesianLayer.transform
are now found in the newMeasuringContext.extraStore
, not inCartesianChartModel.extraStore
. This affects only custom animatedCartesianLayer
implementations.1 For standard usage, no action is required. - In
HorizontalAxis
, the protectedCartesianMeasuringContext.getFullXRange
function is deprecated. See the deprecation message for more.
compose
- Various performance-related optimizations have been made.
- In noninteractive Compose previews—which don’t support asynchronous execution—
CartesianChartHost
now handlesCartesianChartModelProducer
communication synchronously, enabling charts to display as expected. For this to work, the consumer must also move processing to the main thread—for example, by callingrunTransaction
fromrunBlocking
rather thanLaunchedEffect
. This should be done only for previews.
multiplatform
This new module provides Compose Multiplatform support for Android, iOS, and desktop. It has two optional companion modules for Material theming: multiplatform-m2
and multiplatform-m3
. These are equivalent to compose-m2
and compose-m3
.
[versions]
vico = "2.1.0"
[libraries]
vico-multiplatform = { group = "com.patrykandpatrick.vico", name = "multiplatform", version.ref = "vico" }
vico-multiplatform-m2 = { group = "com.patrykandpatrick.vico", name = "multiplatform-m2", version.ref = "vico" }
vico-multiplatform-m2 = { group = "com.patrykandpatrick.vico", name = "multiplatform-m3", version.ref = "vico" }
The multiplatform
API is based on the combination of the compose
and core
APIs, with adjustments for Compose Multiplatform and simplifications enabled by it being a dependency across the board. (In contrast, with compose
and core
, the former depends on Jetpack Compose, but the latter is framework-agnostic, using only lower-level android.graphics
APIs.) There are only some minor differences in feature set:
- A
ComponentShader
equivalent isn’t available yet. You can useShaderBrush
instead. ShapeComponent
doesn’t support shadows yet. This is due to Compose Multiplatform’sPaint
lacking shadow functionality.
multiplatform
is experimental; it will remain available, but breaking changes are more likely. While multiplatform
is Jetpack Compose–compatible, compose
support continues. In the distant future, compose
will be removed in favor of multiplatform
, which will then be renamed to compose
.
Learn more about multiplatform
in the guide and in the API reference; for examples, consult the multiplatform
sample charts.
-
This minor breaking change was allowed because (1) as discussed above, it affects only custom animated
CartesianLayer
implementations, which are rare; (2) addressing it is trivial; and (3) it enabled significant performance improvements for all setups. Deprecation was infeasible primarily because the key aspect here is the removal ofCartesianLayer.transform
-added extras fromCartesianChartModel.extraStore
, not merely their addition toCartesianMeasuringContext.extraStore
. These extras areCartesianLayerDrawingModel
s, which are large and slow to hash.CartesianChartModel.extraStore
, in turn, is hashed frequently; this enables the caching of the results ofExtraStore
lambdas. Moving theCartesianLayerDrawingModel
s to a separateExtraStore
drastically decreased the time taken to hashCartesianChartModel.extraStore
. It also made the caching more effective; now, only those extras that may actually be read in these lambdas are used as keys. These two factors significantly boosted drawing performance. ↩