rememberChartSelection

fun rememberChartSelection(initialIndex: Int? = null, onSelectionChanged: (Int?) -> Unit? = null): ChartSelection(source)

Creates a ChartSelection remembered for the current composition.

Parameters

initialIndex

The initially selected index, or null for no initial selection. Changes to this argument during recomposition do not reset the selection.

onSelectionChanged

Receives actual selection changes using the latest callback from composition, without recreating the state holder. Assigning the holder's ChartSelection.onSelectionChanged property explicitly overrides this callback.