ComposeCharts
ComposeCharts copied to clipboard
Is there a way to avoid this weird behavior when dynamically calculating data for the pie chart?
https://github.com/user-attachments/assets/9b9d27e5-48ee-4f55-95f2-4d34b0c4c65f
PieChart(
modifier =
Modifier
.align(Alignment.CenterHorizontally)
.padding(AltaTheme.dimens.spacingSmall)
.size(200.dp),
data = data.reversed(),
onPieClick = {
println("${it.label} Clicked")
val pieIndex = data.indexOf(it)
data = data.mapIndexed { mapIndex, pie -> pie.copy(selected = pieIndex == mapIndex) }
},
selectedScale = 1f,
scaleAnimEnterSpec = spring<Float>(
dampingRatio = Spring.DampingRatioMediumBouncy,
stiffness = Spring.StiffnessHigh
),
colorAnimEnterSpec = tween(0),
colorAnimExitSpec = tween(0),
scaleAnimExitSpec = tween(0),
spaceDegreeAnimExitSpec = tween(0),
spaceDegree = 0f,
selectedPaddingDegree = 0f,
style = Pie.Style.Stroke(
width = 60.dp
)
)
Hi @KevinMartinezC , put the data in remember and check again.
yes, i already had my data using a remember and get that behavior
It's weird, you are changing the data quickly?
yes the data is changing quickly