Vico
Vico 2.1.0 (in alpha) adds Compose Multiplatform support.

CartesianChartHost

Overview

CartesianChartHost is the entry point for Cartesian charts. It accepts a CartesianChart and a CartesianChartModelProducer, facilitates their communication, and displays the CartesianChart. It also handles scroll and zoom and shows a placeholder when no data is available.

CartesianChartHost(rememberCartesianChart(/* ... */), modelProducer, /* ... */)

Scroll

CartesianChartHost accepts instances of VicoScrollState, enabling scroll customization and programmatic scrolling. Use rememberVicoScrollState to instantiate this class:

val scrollState = rememberVicoScrollState(/* ... */)
CartesianChartHost(scrollState = scrollState, /* ... */)

Scroll, split into Scroll.Absolute and Scroll.Relative, is used to represent scroll values—either absolute (from zero) or relative (from the current value). The following factory functions are available:

AutoScrollCondition defines when to scroll automatically. There are two singletons:

You can create custom implementations of Scroll and AutoScrollCondition for more specific behavior.

Zoom

CartesianChartHost accepts instances of VicoZoomState, enabling zoom customization. Use rememberVicoZoomState to instantiate this class:

val zoomState = rememberVicoZoomState(/* ... */)
CartesianChartHost(zoomState = zoomState, /* ... */)

Zoom is used to define zoom factors. The following factory functions are available:

You can create custom implementations of Zoom for more specific behavior.