Skip to content

Commit

Permalink
Hide pie chart labels for slices smaller than 15%
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Ziehl authored and Kiran Dwarkan committed Aug 22, 2019
1 parent ec7fd75 commit 6f54c35
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,9 @@ public void drawValues(Canvas c) {

angle = angle + angleOffset;

final float minimumSliceSize = 0.15f * 360.0f;
final int entryThresholdForHiding = 2;

final float transformedAngle = rotationAngle + angle * phaseY;

float value = mChart.isUsePercentValuesEnabled() ? entry.getY()
Expand All @@ -513,7 +516,7 @@ public void drawValues(Canvas c) {
final boolean drawYInside = drawValues &&
yValuePosition == PieDataSet.ValuePosition.INSIDE_SLICE;

if (drawXOutside || drawYOutside) {
if ((drawXOutside || drawYOutside) && !(sliceAngle <= minimumSliceSize && entryCount > entryThresholdForHiding)) {

final float valueLineLength1 = dataSet.getValueLinePart1Length();
final float valueLineLength2 = dataSet.getValueLinePart2Length();
Expand Down

0 comments on commit 6f54c35

Please sign in to comment.