CartesianChartHost

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

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

You can also use a manually created CartesianChartModel instance instead of a model producer:

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

Scroll

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

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

Scroll represents scroll values—either absolute (from zero) or relative (from the current value). Scroll.Absolute and Scroll.Relative cover the two cases. 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 VicoZoomState instances, enabling zoom customization. Use rememberVicoZoomState to instantiate VicoZoomState:

Zoom defines zoom factors. The following singletons and factory functions are available:

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

Last updated