From 27669761bf63d57b045ff4c214199fe9db4e0035 Mon Sep 17 00:00:00 2001 From: Daniele Gobbetti Date: Wed, 29 Jul 2015 18:07:35 +0200 Subject: [PATCH] Fix potential race condition when counted steps are above the daily target. Also added a few comments wrt the labels and the values of the pie chart. --- .../activities/WeekStepsChartFragment.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/WeekStepsChartFragment.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/WeekStepsChartFragment.java index 6d8a716ee..1b1246e30 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/WeekStepsChartFragment.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/WeekStepsChartFragment.java @@ -113,15 +113,20 @@ public class WeekStepsChartFragment extends AbstractChartFragment { entries.add(new Entry(totalSteps, 0)); colors.add(akActivity.color); + //we don't want labels on the pie chart data.addXValue(""); - entries.add(new Entry((mTargetSteps - totalSteps), 1)); - colors.add(Color.GRAY); - data.addXValue(""); + if (totalSteps < mTargetSteps) { + entries.add(new Entry((mTargetSteps - totalSteps), 1)); + colors.add(Color.GRAY); + //we don't want labels on the pie chart + data.addXValue(""); + } PieDataSet set = new PieDataSet(entries, ""); set.setColors(colors); data.setDataSet(set); + //this hides the values (numeric) added to the set. These would be shown aside the strings set with addXValue above data.setDrawValues(false); pieChart.setData(data);