futuredapp / donut

Doughnut-like graph view capable of displaying multiple datasets with assignable colors
MIT License
546 stars 46 forks source link

Colors in compose version not being rendered correctly #83

Closed Stjin closed 2 years ago

Stjin commented 2 years ago

Hi,

I am facing an issue and after hours of playground testing I can't tell if I am missing something or if the behaviour between the compose and non-compose version is indeed different. I can't tell if this is a bug or not.

Please refer to the following gist: https://gist.github.com/Stjin/807c430a25adebef76fae8a039cbc2b5

I have created an application with 2 activities

I implemented both the compose as well as the non-compose version of the donut library and recreated 2 identical setups. However the end results is differently rendered. It looks like the compose version reverses the colors?

Compose Compose Native XML



Hope you can help me out ☺

SumeraMartin commented 2 years ago

Hi, you are right the colors are reversed in the compose version 🙈 I'm not sure if this is something that we want to change because it would break the functionality for the users who are already using the library. In case you are facing a problem with this then you can use .reverse() method on the sections in DonutModel.

Stjin commented 2 years ago

Reversing the list does change the location of the sections but does not change the colors. This does not seem to be the solution as the donut colors are still rendered incorrectly but reversed. From my perspective it would be better to have the compose version behave the same as the native version.

SumeraMartin commented 2 years ago

@Stjin Yeah, you are right. I see the issue. Colors are separated from data internally and then values are reversed but the colors are not. Silly mistake. Thanks for pointing it out. I'm creating a PR with a fix.

SumeraMartin commented 2 years ago

@Stjin version 2.2.2 with the fix is released

Stjin commented 2 years ago

Awesome! Thanks for the effort!

Stjin commented 2 years ago

The only difference I see now is the way the sections are rendered (the order or corner radius), not a huge deal but still a little bit of inconsistency.

Compose Compose Native XML
Stjin commented 2 years ago

@SumeraMartin Could you look into the inconsistency issue as well? Thanks!