Skip to main content

2.0.0-alpha.15

This release introduces candlestick charts and prepares the API for the introduction of pie charts.

Breaking changesAddressed
Moderate#427, #430

CandlestickCartesianLayer

CandlestickCartesianLayer enables you to create candlestick charts. See “Candlestick layer” in the wiki for more information.

CartesianChartModelProducer

As described on the “Data” wiki page, you should never run data updates by creating new CartesianChartModelProducers. Such incorrect CartesianChartModelProducer changes will now trigger exceptions.

API changes

Selected APIs have been updated, and the package structure has been reworked. This is primarily in preparation for the introduction of pie charts. All deprecated APIs have been removed.

Migration overview

We recommend the following migration process:

  1. If you’re using any deprecated APIs, take note of the guidance in the deprecation messages.

  2. In Android Studio, go to Settings > Editor > General > Auto Import. At the very bottom, in the Kotlin section, turn on “Add unambiguous imports on the fly.” There is a similar checkbox for Java, so be careful to select the right one.

  3. Remove all Vico imports. Select Edit > Find > Replace in Files. In the upper field, click the rightmost button to turn on regular expressions, then enter the following:

    import com\.patrykandpatrick\.vico\..*\n

    Leave the lower field blank. Click Replace All.

  4. Open each modified file in the editor. Imports for all unambiguous symbols will be added automatically. This may take a few seconds.

  5. If there are any unresolved symbols, hover your cursor over each one, and check if a suitable import is suggested. If so, add it. If not, continue to the next symbol.

  6. For all remaining errors, consult the sections below to find out what changes to make. For previously deprecated APIs, also keep in mind the guidance from the deprecation messages (point 1).

tip

The API reference may come in handy during migration. If you need any help, please start a discussion in the “Q&A” category.

CartesianValueFormatter

ValueFormatter and AxisValueFormatter have been merged into a single API, CartesianValueFormatter. Where a ValueFormatter or AxisValueFormatter instance was accepted, a CartesianValueFormatter instance can now be passed in. CartesianValueFormatter.decimal replaces DecimalFormatValueFormatter and DecimalFormatAxisValueFormatter. CartesianValueFormatter.yPercent replaces PercentageFormatValueFormatter and PercentageFormatAxisValueFormatter.

CartesianMarker

2.0.0-alpha.142.0.0-alpha.15
MarkerCartesianMarker
Marker.EntryModelCartesianMarker.Target
MarkerComponentDefaultCartesianMarker
rememberMarkerComponentrememberDefaultCartesianMarker
MarkerLabelFormatterCartesianMarkerValueFormatter
DefaultMarkerLabelFormatterDefaultCartesianMarkerValueFormatter
MarkerVisibilityChangeListenerCartesianMarkerVisibilityListener

See the DefaultCartesianMarker definition and the DefaultCartesianMarkerValueFormatter definition for examples of how to use the new APIs, particularly Marker.Target. Keep in mind that you can ignore Marker.Targets corresponding to CartesianLayers that aren’t in use in your chart.

Shape

The Shapes object has been removed in favor of the Shape companion object, and some of the members have been renamed. See the Shape section of the “Components” wiki page for an API list.

DynamicShader

The DynamicShaders object has been removed in favor of the DynamicShader companion object, and some of the members have been renamed. See the DynamicShader section of the “Components” wiki page for an API list.

Dimensions

Dimensions is now an immutable data class, and MutableDimensions has been removed.

Instead of dimensionsOf, use Dimensions.of. Dimensions.Empty replaces emptyDimensions. Instead of mutation, use Dimensions#copy.

*Context

MeasureContext and DrawContext remain available but no longer house any CartesianChart-specific data. This data is stored in CartesianMeasureContext and CartesianDrawContext. In most places where MeasureContext or DrawContext was present, CartesianMeasureContext or CartesianDrawContext is now used. In the unlikely event that you need CartesianMeasureContext or CartesianDrawContext where MeasureContext or DrawContext is now found, use casting.