fixup! HeartRateChart: Add weekly and monthly view

This commit is contained in:
Simon Brand 2025-01-07 18:48:42 +00:00
parent 9d2fe54d67
commit b56de42343

View File

@ -144,7 +144,7 @@ public class HeartRatePeriodFragment extends AbstractChartFragment<HeartRatePeri
}
private HeartRateData fetchHeartRateDataForDay(ChartsHost chartsHost, DBHandler db, GBDevice device, int startTs) {
int endTs = startTs + 24 * 60 * 60 - 1;
int endTs = startTs + SEC_PER_DAY - 1;
List<? extends ActivitySample> samples = getActivitySamples(db, device, startTs, endTs);
int restingHeartRate = DATA_INVALID;
@ -204,6 +204,9 @@ public class HeartRatePeriodFragment extends AbstractChartFragment<HeartRatePeri
x.setDrawLimitLinesBehindData(true);
x.setPosition(XAxis.XAxisPosition.BOTTOM);
x.setValueFormatter(getChartMultipleDayValueFormatter());
if (TOTAL_DAYS == 7) {
x.setLabelCount(TOTAL_DAYS, true);
}
YAxis yAxisLeft = hrLineChart.getAxisLeft();
yAxisLeft.setEnabled(true);
@ -295,7 +298,7 @@ public class HeartRatePeriodFragment extends AbstractChartFragment<HeartRatePeri
return new ValueFormatter() {
@Override
public String getFormattedValue(float value) {
return formatLetterDay.format(new Date((int)value * 1000));
return formatLetterDay.format(new Date((int)value * 1000L));
}
};
}