androidplot icon indicating copy to clipboard operation
androidplot copied to clipboard

Pie chart are not clickable with large segment

Open messenger63 opened this issue 2 years ago • 1 comments

Hi, there is issue with Pie Chart. Steps to reproduce:

  • open sample app;
  • set segments, like 8, 1, 1;
  • run app, click on small segment, then click on large segment at 0 degree (at the beginning of segment on the screen); Results: clicks are not working, there is some issue in segment calculation.

Seems like this issue happens when you have large segment, single segment more than 180deg, then part of that segment at the beginning are not clickable.

Please, reply if this issue could be fixed in near future.

messenger63 avatar Apr 27 '23 08:04 messenger63

The issue is in calculating dist at PieRenderer.getContainingSegment() Probably it should be something like this:

double dist = signedDistance(offset, angle); double endDist = signedDistance(offset, lastOffset); if (dist < 0) { // added dist = FULL_PIE_DEGS + dist; // added } // added if(endDist < 0) { // segment accounts for more than 50% of the pie and wrapped around // need to correct: endDist = FULL_PIE_DEGS + endDist; } Or some fix for signedDistance() method calculations.

messenger63 avatar Apr 27 '23 13:04 messenger63