Releases: patrykandpatrick/vico
v2.0.0-alpha.3
This release fixes an issue where DynamicShaders
worked improperly in line charts whose y ranges didn’t include zero. Read the release notes.
v2.0.0-alpha.2
This update continues the API cleanup, enables dynamic MergeMode
customization, and brings a performance boost. Read the release notes.
v2.0.0-alpha.1
For this release, to simplify the library, reduce its size, and prepare for the introduction of candlestick charts and pie charts, we’ve consolidated how charts are created. We’re also introducing split line styles for line charts. Read the release notes.
v1.13.1
This release includes the following changes.
API changes
- In
MutableExtraStore
, an error affectingremove
has been resolved. The function accepted onlyExtraStore.Key
instances withDrawingModel
or a subtype thereof as the type parameter’s value. Now, allExtraStore.Key
instances are accepted.
v1.13.0
This release includes the following changes.
Since v1.13.0-beta.1
Resolved issues
- Crashes occurred in
ComposedChart
when no model was available or when the available model had fewer data sets than theComposedChart
had nestedChart
s.
Since v1.12.0
Improvements
- The default
AxisItemPlacer.Vertical
implementation now requests no insets whenmaxItemCount
is zero. Thus, to create an axis with no labels, ticks, or guidelines, it’s sufficient to useAxisItemPlacer.Vertical.default(maxItemCount = 0)
. (See #445.) - When the precision of a chart’s x values is too large for the GCD of their deltas to be calculated, a descriptive exception is now thrown. (See #374.)
API changes
-
The animation system has been entirely rewritten. Difference animations are smoother, behave better when the y range changes due to a data update, and exhibit better performance. Redundant calls to
AxisValuesOverrider
functions are no longer made, and numerous visual glitches have been resolved.DiffProcessor
has been removed in favor ofChart.ModelTransformer
andDrawingModelInterpolator
. Use the latter for custom difference animations.ColumnChart
andLineChart
havedrawingModelInterpolator
fields, and in thecompose
module, thelineChart
andcolumnChart
functions havedrawingModelInterpolator
parameters. InChartModelProducer
,progressModel
has been renamed totransformModel
, and itsprogress
parameter has been renamed tofraction
. This change is reflected across related APIs. -
Updates have been made to
ChartEntryModelProducer
andComposedChartEntryModelProducer
.-
ComposedChartEntryModelProducer
, rather than being a combination ofChartEntryModelProducer
s, is now independent and uses a list of data sets, with each one corresponding to a single nestedChart
. This makes the API easier to use and resolves synchronization-related issues. To run data updates, userunTransaction
orrunTransactionSuspending
. To create aComposedChartEntryModelProducer
, useComposedChartEntryModelProducer.build
, which lets you run an initialTransaction
. Refer to theTransaction
documentation for more information. Below, the first code block uses APIs from Vico 1.12.0, and the second one shows how to achieve the same result in Vico 1.13.0.val chartEntryModelProducer1 = ChartEntryModelProducer(a) val chartEntryModelProducer2 = ChartEntryModelProducer(b) val composedChartEntryModelProducer = chartEntryModelProducer1 + chartEntryModelProducer2 chartEntryModelProducer1.setEntries(c) chartEntryModelProducer2.setEntries(d)
val composedChartEntryModelProducer = ComposedChartEntryModelProducer.build { add(a) add(b) } composedChartEntryModelProducer.runTransaction { /* Because we’re not calling `populate`, the new list of data sets is empty, so we use `add` instead of `set`. */ add(c) add(d) }
-
The
ComposedChartEntryModelProducer.composedChartEntryModelOf
function has been removed in favor of theplus
operator function forChartEntryModel
s. -
To resolve a problem where
ChartEntryModelProducer
andComposedChartEntryModelProducer
accepted all updates immediately, even if an update was already running—in which caseConcurrentModificationException
s andNullPointerException
s occurred—we’ve reworked the update mechanism.ChartEntryModelProducer#setEntries
,ComposedChartEntryModelProducer#runTransaction
, andComposedChartEntryModelProducer.Transaction#commit
can reject an update if there’s already one in progress. Each of these functions returns aBoolean
indicating whether the requested update has been accepted or rejected.ChartEntryModelProducer#setEntriesSuspending
,ComposedChartEntryModelProducer#runTransactionSuspending
, andComposedChartEntryModelProducer.Transaction#commitSuspending
suspend the current coroutine until an update can be run. Data updates typically take a few milliseconds to be processed, so unless your chart is frequently updated and you experienced CMEs and NPEs in previous Vico versions,ChartEntryModelProducer#setEntries
,ComposedChartEntryModelProducer#runTransaction
, andComposedChartEntryModelProducer.Transaction#commit
are safe to use. BecauseChartEntryModelProducer
andComposedChartEntryModelProducer
now use coroutines, they no longer acceptExecutor
s—rather, you can specify a customCoroutineDispatcher
. (See #408.) -
ChartEntryModelProducer
andComposedChartEntryModelProducer
now let you define extras (auxiliary data). These can later be read viaChartEntryModel#extraStore
. Extras are useful for properties that should change with the chart data and can’t be directly derived from it or should be precalculated. For example, if you create a list of x-axis labels for your chart data, you can store this list as an extra to ensure that it’s always in sync with the data.ChartEntryModelProducer#setEntries
has anupdateExtras
parameter, and inComposedChartEntryModelProducer
, theTransaction
class has anupdateExtras
function. (See #363.)
-
-
Automatic padding for extreme
HorizontalAxis
labels has been introduced. WithHorizontalLayout.FullWidth
, this option adds such an amount of horizontal padding to the chart that the labels forChartValues#minX
andChartValues#maxX
are fully visible. To turn this on, use theaddExtremeLabelPadding
parameter ofAxisItemPlacer.Horizontal.default
or theaddExtremeHorizontalAxisLabelPadding
XML attribute from theAxis
attribute set.AxisItemPlacer.Horizontal
has two new functions,getAddFirstLabelPadding
andgetAddLastLabelPadding
.AxisRenderer
has a newupdateHorizontalDimensions
function. In theChart
interface,updateHorizontalDimensions
replacesgetHorizontalDimensions
. (See #431.) -
Chart placeholders have been added. These are displayed in charts with
ChartModelProducer
s when noChartEntryModel
is available (no data has been added to theChartModelProducer
). TheChart
composable function has aplaceholder
slot, andBaseChartView
accepts a child view. For the latter, you can also useBaseChartView#setPlaceholder
. In both cases, the default placeholder is blank. Internally, the somewhat ambiguous concept of emptyChartEntryModel
s has been removed—if there’s no data, there’s noChartEntryModel
. Thus, where appropriate,ChartEntryModel
types are now nullable. In particularChartModelProducer#getModel
may now returnnull
. If you’re sure that aChartEntryModel
is available (data has been added), you can useChartModelProducer#requireModel
. (See #414.) -
For greater flexibility,
HorizontalLayout.FullWidth
now lets you add both scalable (zoom-dependent) and unscalable padding.startPaddingDp
andendPaddingDp
have been replaced withscalableStartPaddingDp
,scalableEndPaddingDp
,unscalableStartPaddingDp
, andunscalableEndPaddingDp
. TheHorizontalLayout.fullWidth
function from thecompose
module has been updated accordingly. (We were unable to use deprecation because Kotlin’s overload resolution doesn’t consider it. When both a deprecated overload and a non-deprecated overload match a call, the deprecated overload may be used, and there’s no direct way around this.) ThestartContentPadding
andendContentPadding
XML attributes have been marked as deprecated and replaced withscalableStartContentPadding
,scalableEndContentPadding
,unscalableStartContentPadding
, andunscalableEndContentPadding
attributes. -
In
MeasureContext
,chartValuesManager
(of typeChartValuesManager
) has been replaced withchartValuesProvider
(of typeChartValuesProvider
).ChartValuesProvider
has the samegetChartValues
function thatChartValuesManager
does, so it’s sufficient to replacechartValuesManager
withchartValuesProvider
where the former can’t be resolved.ChartValues
updates are to be run earlier on. -
Selected deprecated APIs with
DeprecationLevel.ERROR
have been removed.
Resolved issues
- Automatic scrolling failed to work in some instances. (See here.)
- Automatically scaled charts’ initial zoom could be incorrectly calculated. (See here.)
- XML attributes could fail to be applied.
- The default x step for multi-series data sets could be incorrect. (See #417.)
- The
plus
operator function forChartEntryModel
s incorrectly handledComposedChartEntryModel
s. - Charts created via the
Chart
composable function didn’t respond to changes to thehorizontalLayout
parameter’s value and density changes that didn’t cause the function to leave and reenter the composition.
Dependency updates
- All modules now use Kotlin 1.9.20.
- In the
compose
,compose-m2
, andcompose-m3
modules, the Jetpack Compose BOM has been updated from version 2023.09.01 to version 2023.10.01.
v1.13.0-beta.1
This release includes the following changes.
Additions
ColumnChart
andLineChart
now havedrawingModelInterpolator
properties. In thecompose
module, thelineChart
andcolumnChart
functions havedrawingModelInterpolator
parameters. This enables you to apply customDrawingModelInterpolator
s.
API changes
ChartEntryModelProducer
andComposedChartEntryModelProducer
now let you define extras (auxiliary data). These can later be read viaChartEntryModel#extraStore
. Extras are useful for properties that should change with the chart data and can’t be directly derived from it or should be precalculated. For example, if you create a list of x-axis labels for your chart data, you can store this list as an extra to ensure that it’s always in sync with the data.ChartEntryModelProducer#setEntries
has anupdateExtras
parameter, and inComposedChartEntryModelProducer
, theTransaction
class has anupdateExtras
function. As part of this change,DrawingModelStore
has been renamed toExtraStore
and updated to allow for storing data of any type. (See #363.)- In
ChartModelProducer
,progressModel
has been renamed totransformModel
, and itsprogress
parameter has been renamed tofraction
. This change is reflected across related APIs. - The two
*ContentPadding
XML attributes have been marked as deprecated and replaced withscalable*ContentPadding
andunscalable*ContentPadding
attributes. This relates to the introduction of the ability to add unscalable padding viaHorizontalLayout.FullWidth
—see the changelog for Vico 1.13.0 Alpha 7.
Bug fixes
- An issue where XML attributes could fail to be applied has been resolved.
Dependency updates
- All modules now use Kotlin 1.9.20.
v1.13.0-alpha.9
This release includes the following changes.
Improvements
- The default
AxisItemPlacer.Vertical
implementation now requests no insets whenmaxItemCount
is zero. Thus, to create an axis with no labels, ticks, or guidelines, it’s sufficient to useAxisItemPlacer.Vertical.default(maxItemCount = 0)
. (See #445.)
API changes
- Automatic padding for extreme
HorizontalAxis
labels has been introduced. WithHorizontalLayout.FullWidth
, this option adds such an amount of horizontal padding to the chart that the labels forChartValues#minX
andChartValues#maxX
are fully visible. To turn this on, use theaddExtremeLabelPadding
parameter ofAxisItemPlacer.Horizontal.default
or theaddExtremeHorizontalAxisLabelPadding
XML attribute from theAxis
attribute set.AxisItemPlacer.Horizontal
has two new functions,getAddFirstLabelPadding
andgetAddLastLabelPadding
.AxisRenderer
has a newupdateHorizontalDimensions
function. In theChart
interface,updateHorizontalDimensions
replacesgetHorizontalDimensions
. (See #431.) - Chart placeholders have been added. These are displayed in charts with
ChartModelProducer
s when noChartEntryModel
is available (no data has been added to theChartModelProducer
). TheChart
composable function has aplaceholder
slot, andBaseChartView
accepts a child view. For the latter, you can also useBaseChartView#setPlaceholder
. In both cases, the default placeholder is blank. Internally, the somewhat ambiguous concept of emptyChartEntryModel
s has been removed—if there’s no data, there’s noChartEntryModel
. Thus, where appropriate,ChartEntryModel
types are now nullable. In particularChartModelProducer#getModel
may now returnnull
. If you’re sure that aChartEntryModel
is available (data has been added), you can useChartModelProducer#requireModel
. (See #414.)
Bug fixes
- A problem where
ChartEntryModelProducer
andComposedChartEntryModelProducer
could cause mutex-relatedIllegalStateException
s has been resolved. - Several animation-related bugs affecting
BaseChartView
have been fixed.
Dependency updates
- In the
compose
,compose-m2
, andcompose-m3
modules, the Jetpack Compose BOM has been updated from version 2023.10.00 to version 2023.10.01.
v1.13.0-alpha.8
This release includes the following changes.
Bug fixes
- An issue where automatically scaled charts’ initial zoom could be incorrectly calculated has been resolved. (See here.)
v1.13.0-alpha.7
This release includes the following changes.
API changes
- For greater flexibility,
HorizontalLayout.FullWidth
now lets you add both scalable (zoom-dependent) and unscalable padding.startPaddingDp
andendPaddingDp
have been replaced withscalableStartPaddingDp
,scalableEndPaddingDp
,unscalableStartPaddingDp
, andunscalableEndPaddingDp
. TheHorizontalLayout.fullWidth
function from thecompose
module has been updated accordingly. (We were unable to use deprecation because Kotlin’s overload resolution doesn’t consider it. When both a deprecated overload and a non-deprecated overload match a call, the deprecated overload may be used, and there’s no direct way around this.)
v1.13.0-alpha.6
This release includes the following changes.
Bug fixes
BaseChartView#setModel
now updatesMeasureContext#chartValuesProvider
, soIllegalStateException
s thrown byChartValuesProvider.Empty
(“ChartValuesProvider.Empty#getChartValues
shouldn’t be used”) no longer occur.- A problem where the default x step for multi-series data sets could be incorrect, potentially causing
IllegalStateException
s inColumnChart
s (“Each entry’s x value must be a multiple of the x step”), has been fixed. (See #417.) - An issue where
BaseChartView
could causeNullPointerException
s when attached or detached has been resolved.