BarChart

fun BarChart(data: ChartData, modifier: Modifier = Modifier, style: BarChartStyle = BarChartDefaults.style(), title: String? = null, selection: ChartSelection = rememberChartSelection(), interactionEnabled: Boolean = true, animateOnStart: Boolean = true, selectedValueFormatter: ChartValueFormatter = BarChartDefaults.selectedValueFormatter, axisValueFormatter: ChartValueFormatter = BarChartDefaults.axisValueFormatter, subtitle: String? = null)(source)

Displays one indexed series of finite Double values as vertical bars.

modifier applies to both the chart and validation errors. title is optional and independent of category labels. Empty categories hide X labels; selected readouts then show only the formatted value. selection always identifies a source bar, including when compact mode displays bucket averages. Tapping a bucket selects its middle source bar; selecting the same bucket again clears selection.

Changing data to an unequal value clears selection; resizing or changing density does not. Disabling interactionEnabled disables all user controls, but programmatic selection still renders. animateOnStart controls initial reveal, not subsequent update animations. selectedValueFormatter formats selected raw values; axisValueFormatter formats Y ticks.

subtitle appears below the title and stays visible while a value is selected.

Exactly one series of at least two finite values is required. Negative values are supported. Categories may be empty; otherwise their count must match the value count. Invalid data renders validation errors in place of the chart.