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.
This commit is contained in:
parent
3ed4856bf6
commit
27669761bf
|
@ -113,15 +113,20 @@ public class WeekStepsChartFragment extends AbstractChartFragment {
|
||||||
|
|
||||||
entries.add(new Entry(totalSteps, 0));
|
entries.add(new Entry(totalSteps, 0));
|
||||||
colors.add(akActivity.color);
|
colors.add(akActivity.color);
|
||||||
|
//we don't want labels on the pie chart
|
||||||
data.addXValue("");
|
data.addXValue("");
|
||||||
|
|
||||||
entries.add(new Entry((mTargetSteps - totalSteps), 1));
|
if (totalSteps < mTargetSteps) {
|
||||||
colors.add(Color.GRAY);
|
entries.add(new Entry((mTargetSteps - totalSteps), 1));
|
||||||
data.addXValue("");
|
colors.add(Color.GRAY);
|
||||||
|
//we don't want labels on the pie chart
|
||||||
|
data.addXValue("");
|
||||||
|
}
|
||||||
|
|
||||||
PieDataSet set = new PieDataSet(entries, "");
|
PieDataSet set = new PieDataSet(entries, "");
|
||||||
set.setColors(colors);
|
set.setColors(colors);
|
||||||
data.setDataSet(set);
|
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);
|
data.setDrawValues(false);
|
||||||
pieChart.setData(data);
|
pieChart.setData(data);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue