Package-level declarations
JengaBarChart: vertical bars from a shared baseline, optionally selectable.
Types
Link copied to clipboard
How a JengaBarChart lays its bars out.
Link copied to clipboard
class JengaBarChartColors(val bar: Color, val selectedBar: Color, val unselectedBar: Color, val label: Color, val selectedLabel: Color)
Resolved colors for a JengaBarChart. Override via JengaBarChartDefaults.colors.
Link copied to clipboard
object JengaBarChartDefaults
Defaults and token mappings for JengaBarChart.
Link copied to clipboard
One bar of a JengaBarChart: a label under the bar and a non-negative value.
Functions
Link copied to clipboard
fun JengaBarChart(entries: List<JengaBarChartEntry>, barContentDescription: (JengaBarChartEntry) -> String, modifier: Modifier = Modifier, selectedIndex: Int? = null, onSelect: (Int) -> Unit? = null, maxValue: Float? = null, arrangement: JengaBarChartArrangement = JengaBarChartArrangement.Fill, plotHeight: Dp = JengaBarChartDefaults.PlotHeight, minBarHeight: Dp = JengaBarChartDefaults.MinBarHeight, barMaxWidth: Dp = JengaBarChartDefaults.BarMaxWidth, barSpacing: Dp = JengaBarChartDefaults.barSpacing, barShape: Shape = JengaBarChartDefaults.barShape, labelSpacing: Dp = JengaBarChartDefaults.labelSpacing, contentPadding: PaddingValues = JengaBarChartDefaults.contentPadding, labelStyle: TextStyle = JengaBarChartDefaults.labelStyle, selectedLabelStyle: TextStyle = JengaBarChartDefaults.selectedLabelStyle, colors: JengaBarChartColors = JengaBarChartDefaults.colors(), animationSpec: AnimationSpec<Float> = JengaBarChartDefaults.animationSpec, valueLabel: @Composable (entry: JengaBarChartEntry, selected: Boolean) -> Unit? = null, label: @Composable (entry: JengaBarChartEntry, selected: Boolean) -> Unit = { entry, selected ->
JengaText(
text = entry.label,
style = if (selected) selectedLabelStyle else labelStyle,
color = if (selected) colors.selectedLabel else colors.label,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
})
A vertical bar chart: one bar per entry, growing from a shared baseline, with its label underneath. Bar heights are relative to maxValue and animate when the data changes. With onSelect each bar's whole slot is a tap target and the chart reads as a group of selectable bars; without it the chart is static. There are no axes; put the figure the selection refers to next to the chart, or add a valueLabel at each bar's tip.