Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to avoid this weird behavior when dynamically calculating data for the pie chart? #54

Open
KevinMartinezC opened this issue Nov 29, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@KevinMartinezC
Copy link

Effect.when.it.s.loeadin.mov
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
           )
       )
@ehsannarmani
Copy link
Owner

Hi @KevinMartinezC , put the data in remember and check again.

@KevinMartinezC
Copy link
Author

yes, i already had my data using a remember and get that behavior

@ehsannarmani
Copy link
Owner

It's weird, you are changing the data quickly?

@KevinMartinezC
Copy link
Author

yes the data is changing quickly

@ehsannarmani ehsannarmani added the bug Something isn't working label Dec 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants