From 3675386c13ccf96038400080d4040a5295d9bbd1 Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Wed, 5 Apr 2017 22:42:54 +0200 Subject: [PATCH] Fix spider arms haging out of pie slices Also make the Pie in week sleep chart look as the other pie chart in "Your Sleep" --- .../activities/charts/AbstractWeekChartFragment.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/AbstractWeekChartFragment.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/AbstractWeekChartFragment.java index 1acba919d..dea94826a 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/AbstractWeekChartFragment.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/charts/AbstractWeekChartFragment.java @@ -139,13 +139,8 @@ public abstract class AbstractWeekChartFragment extends AbstractChartFragment { entries.add(new PieEntry(value, pieLabels[i])); } - set.setValueTextColor(DESCRIPTION_COLOR); - set.setValueTextSize(13f); - set.setXValuePosition(PieDataSet.ValuePosition.OUTSIDE_SLICE); - set.setValueFormatter(getPieValueFormatter()); set.setColors(getColors()); - //this hides the values (numeric) added to the set. These would be shown aside the strings set with addXValue above if (totalValues.length < 2) { if (totalValue < mTargetValue) { entries.add(new PieEntry((mTargetValue - totalValue))); @@ -158,6 +153,13 @@ public abstract class AbstractWeekChartFragment extends AbstractChartFragment { if (totalValues.length < 2) { data.setDrawValues(false); } + else { + set.setXValuePosition(PieDataSet.ValuePosition.OUTSIDE_SLICE); + set.setYValuePosition(PieDataSet.ValuePosition.OUTSIDE_SLICE); + set.setValueTextColor(DESCRIPTION_COLOR); + set.setValueTextSize(13f); + set.setValueFormatter(getPieValueFormatter()); + } return new DayData(data, formatPieValue((int) totalValue)); }