Skip to main content

CamoPieChart

Parts of a whole, as a pie or (with donut) a ring with center content in the hole. Each slice shows its share when it is wide enough (ResolvedChartStyle.labelThreshold); the legend lists every slice with its value and share and hides or shows slices. The app owns the selection (selected, onSelect): clicking a slice, or Enter or Space on the focused one, calls onSelect with its index (null when it was already selected), and the selected slice moves out. The plot is one image node; focusing it walks the slices clockwise (Left, Right, Up and Down) and announces "Search, 45%, 4,500". Negative values count as zero; with every value zero the empty state shows. Angles keep their clockwise direction in right-to-left layouts.

API​

public fun CamoPieChart(
slices: List<PieSlice>,
title: String,
modifier: Modifier = Modifier,
donut: Boolean = false,
center: (@Composable () -> Unit)? = null,
selected: Int? = null,
onSelect: ((Int?) -> Unit)? = null,
startAngle: Float = TOP,
valueFormat: (Double) -> String = ::formatChartNumber,
loading: Boolean = false,
empty: (@Composable () -> Unit)? = null,
showTable: Boolean = false,
plotHeight: Dp = DefaultPieHeight,
style: ChartStyle? = null,
)
NameTypeDefault
slicesList<PieSlice>required
titleStringrequired
modifierModifierModifier
donutBooleanfalse
center(@Composable () -> Unit)?null
selectedInt?null
onSelect((Int?) -> Unit)?null
startAngleFloatTOP
valueFormat(Double) -> String::formatChartNumber
loadingBooleanfalse
empty(@Composable () -> Unit)?null
showTableBooleanfalse
plotHeightDpDefaultPieHeight
styleChartStyle?null
Design notes

Why CamoPieChart works this way, its states and its edge cases: contributor docs.