From 16e8947ef64140c180929c794335eda457ef23a8 Mon Sep 17 00:00:00 2001 From: Don Phillips Date: Mon, 14 Nov 2016 15:53:40 -0800 Subject: [PATCH] This should fix Issue #2432. Utils.FLOAT_EPSILON is a value slightly greater than one, so judging by the comments, it was being used incorrectly. --- .../mikephil/charting/renderer/PieChartRenderer.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/PieChartRenderer.java b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/PieChartRenderer.java index ff22018364..bc6771c086 100644 --- a/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/PieChartRenderer.java +++ b/MPChartLib/src/main/java/com/github/mikephil/charting/renderer/PieChartRenderer.java @@ -232,7 +232,7 @@ protected void drawDataSet(Canvas c, IPieDataSet dataSet) { int visibleAngleCount = 0; for (int j = 0; j < entryCount; j++) { // draw only if the value is greater than zero - if ((Math.abs(dataSet.getEntryForIndex(j).getY()) > Utils.FLOAT_EPSILON)) { + if ((Math.abs(dataSet.getEntryForIndex(j).getY()) > 0)) { visibleAngleCount++; } } @@ -247,7 +247,7 @@ protected void drawDataSet(Canvas c, IPieDataSet dataSet) { Entry e = dataSet.getEntryForIndex(j); // draw only if the value is greater than zero - if ((Math.abs(e.getY()) > Utils.FLOAT_EPSILON)) { + if ((Math.abs(e.getY()) > 0)) { if (!mChart.needsHighlight(j)) { @@ -269,7 +269,7 @@ protected void drawDataSet(Canvas c, IPieDataSet dataSet) { float arcStartPointX = center.x + radius * (float) Math.cos(startAngleOuter * Utils.FDEG2RAD); float arcStartPointY = center.y + radius * (float) Math.sin(startAngleOuter * Utils.FDEG2RAD); - if (sweepAngleOuter % 360f <= Utils.FLOAT_EPSILON) { + if (sweepAngleOuter % 360f == 0.f) { // Android is doing "mod 360" mPathBuffer.addCircle(center.x, center.y, radius, Path.Direction.CW); } else { @@ -772,7 +772,7 @@ public void drawHighlighted(Canvas c, Highlight[] indices) { int visibleAngleCount = 0; for (int j = 0; j < entryCount; j++) { // draw only if the value is greater than zero - if ((Math.abs(set.getEntryForIndex(j).getY()) > Utils.FLOAT_EPSILON)) { + if ((Math.abs(set.getEntryForIndex(j).getY()) > 0)) { visibleAngleCount++; } }