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"
master
Andreas Shimokawa 2017-04-05 22:42:54 +02:00
parent 45eb14684b
commit 3675386c13
1 changed files with 7 additions and 5 deletions

View File

@ -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));
}