Skip to content

v2.1.0

Compare
Choose a tag to compare
@patrykandpatrickbot patrykandpatrickbot released this 16 Mar 17:45
· 29 commits to master since this release
eb72754

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

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 ExtraStores have been decoupled: extras added via CartesianLayer.transform are now found in the new MeasuringContext.extraStore, not in CartesianChartModel.extraStore. This affects only custom animated CartesianLayer implementations.1 For standard usage, no action is required.
  • In HorizontalAxis, the protected CartesianMeasuringContext.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 handles CartesianChartModelProducer 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 calling runTransaction from runBlocking rather than LaunchedEffect. 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 use ShaderBrush instead.
  • ShapeComponent doesn’t support shadows yet. This is due to Compose Multiplatform’s Paint 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.

  1. 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 of CartesianLayer.transform-added extras from CartesianChartModel.extraStore, not merely their addition to CartesianMeasuringContext.extraStore. These extras are CartesianLayerDrawingModels, which are large and slow to hash. CartesianChartModel.extraStore, in turn, is hashed frequently; this enables the caching of the results of ExtraStore lambdas. Moving the CartesianLayerDrawingModels to a separate ExtraStore drastically decreased the time taken to hash CartesianChartModel.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.