MetricChartScaffold

fun MetricChartScaffold(isEmpty: Boolean, legendData: List<LegendData>, modifier: Modifier = Modifier, hiddenSet: Set<Int> = emptySet(), onToggle: (Int) -> Unit? = null, content: @Composable ColumnScope.(CartesianChartModelProducer, Modifier) -> Unit)(source)

Common scaffold for all metric chart composables. Provides:

  • A Column container with the supplied modifier

  • An empty-data guard (returns early when isEmpty is true)

  • A remembered CartesianChartModelProducer passed to content

  • A trailing Legend strip

Parameters

isEmpty

Whether the chart data is empty — when true, nothing is rendered.

legendData

Legend items shown below the chart.

hiddenSet

Indices of hidden legend items (toggleable legend).

onToggle

Callback when a legend item is toggled; when null, a read-only legend is rendered.

content

Builder lambda receiving the CartesianChartModelProducer and a standard Modifier.weight(1f) suitable for the chart area.

A single CartesianChartModelProducer is created per scaffold instance. Vico forbids swapping the producer attached to a live CartesianChartHost (it throws "A new CartesianChartModelProducer was provided…"), so callers must push new data through CartesianChartModelProducer.runTransaction instead of recreating the producer. Keying the scaffold on external state (e.g. a selected channel) caused exactly that crash, so the previous key parameter was removed.