mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-08 19:27:04 +01:00
Steps/Sleep activties: update lines and offsets
This commit is contained in:
parent
39707a52da
commit
88c8629ec0
@ -147,7 +147,12 @@ public abstract class AbstractWeekChartFragment extends AbstractActivityChartFra
|
||||
barData.setValueTextColor(Color.GRAY); //prevent tearing other graph elements with the black text. Another approach would be to hide the values cmpletely with data.setDrawValues(false);
|
||||
barData.setValueTextSize(10f);
|
||||
|
||||
barChart.getAxisLeft().setAxisMaximum(Math.max(set.getYMax(), mTargetValue) + 60);
|
||||
|
||||
LimitLine target = new LimitLine(mTargetValue);
|
||||
target.setLineWidth(1.5f);
|
||||
target.enableDashedLine(15f, 10f, 0f);
|
||||
target.setLineColor(getResources().getColor(R.color.chart_deep_sleep_dark));
|
||||
barChart.getAxisLeft().removeAllLimitLines();
|
||||
barChart.getAxisLeft().addLimitLine(target);
|
||||
|
||||
@ -156,6 +161,8 @@ public abstract class AbstractWeekChartFragment extends AbstractActivityChartFra
|
||||
average = Math.abs(balance / TOTAL_DAYS_FOR_AVERAGE);
|
||||
}
|
||||
LimitLine average_line = new LimitLine(average);
|
||||
average_line.setLineWidth(1.5f);
|
||||
average_line.enableDashedLine(15f, 10f, 0f);
|
||||
average_line.setLabel(getString(R.string.average, getAverage(average)));
|
||||
|
||||
if (average > (mTargetValue)) {
|
||||
|
@ -25,7 +25,6 @@ import com.github.mikephil.charting.components.YAxis;
|
||||
import com.github.mikephil.charting.data.Entry;
|
||||
import com.github.mikephil.charting.data.LineData;
|
||||
import com.github.mikephil.charting.data.LineDataSet;
|
||||
import com.github.mikephil.charting.formatter.ValueFormatter;
|
||||
import com.github.mikephil.charting.interfaces.datasets.ILineDataSet;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
@ -34,10 +33,7 @@ import org.slf4j.LoggerFactory;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
@ -144,10 +140,6 @@ public class StepsDailyFragment extends StepsFragment<StepsDailyFragment.StepsDa
|
||||
stepsEntry.label = getString(R.string.steps);
|
||||
stepsEntry.formColor = getResources().getColor(R.color.steps_color);
|
||||
legendEntries.add(stepsEntry);
|
||||
final LegendEntry goalEntry = new LegendEntry();
|
||||
goalEntry.label = getString(R.string.miband_prefs_fitness_goal);
|
||||
goalEntry.formColor = Color.GRAY;
|
||||
legendEntries.add(goalEntry);
|
||||
stepsChart.getLegend().setTextColor(TEXT_COLOR);
|
||||
stepsChart.getLegend().setCustom(legendEntries);
|
||||
|
||||
@ -184,11 +176,12 @@ public class StepsDailyFragment extends StepsFragment<StepsDailyFragment.StepsDa
|
||||
lineDataSet.setFillColor(getResources().getColor(R.color.steps_color ));
|
||||
|
||||
final LimitLine goalLine = new LimitLine(STEPS_GOAL);
|
||||
goalLine.setLineColor(Color.GRAY);
|
||||
goalLine.setLineColor(getResources().getColor(R.color.steps_color));
|
||||
goalLine.setLineWidth(1.5f);
|
||||
goalLine.enableDashedLine(10f, 10f, 0f);
|
||||
goalLine.enableDashedLine(15f, 10f, 0f);
|
||||
stepsChart.getAxisLeft().removeAllLimitLines();
|
||||
stepsChart.getAxisLeft().addLimitLine(goalLine);
|
||||
stepsChart.getAxisLeft().setAxisMaximum(Math.max(lineDataSet.getYMax(), STEPS_GOAL) + 2000);
|
||||
|
||||
final List<ILineDataSet> lineDataSets = new ArrayList<>();
|
||||
lineDataSets.add(lineDataSet);
|
||||
|
@ -112,10 +112,11 @@ public class StepsPeriodFragment extends StepsFragment<StepsPeriodFragment.Steps
|
||||
yAxisLeft.setEnabled(true);
|
||||
yAxisLeft.setTextColor(CHART_TEXT_COLOR);
|
||||
yAxisLeft.setAxisMinimum(0f);
|
||||
final LimitLine target = new LimitLine(STEPS_GOAL);
|
||||
target.setLineColor(Color.GRAY);
|
||||
target.enableDashedLine(10f, 10f, 0f);
|
||||
yAxisLeft.addLimitLine(target);
|
||||
final LimitLine goalLine = new LimitLine(STEPS_GOAL);
|
||||
goalLine.setLineColor(getResources().getColor(R.color.steps_color));
|
||||
goalLine.setLineWidth(1.5f);
|
||||
goalLine.enableDashedLine(15f, 10f, 0f);
|
||||
yAxisLeft.addLimitLine(goalLine);
|
||||
|
||||
final YAxis yAxisRight = stepsChart.getAxisRight();
|
||||
yAxisRight.setEnabled(true);
|
||||
@ -166,6 +167,7 @@ public class StepsPeriodFragment extends StepsFragment<StepsPeriodFragment.Steps
|
||||
set.setColors(getResources().getColor(R.color.steps_color));
|
||||
final XAxis x = stepsChart.getXAxis();
|
||||
x.setValueFormatter(getStepsChartDayValueFormatter(stepsData));
|
||||
stepsChart.getAxisLeft().setAxisMaximum(Math.max(set.getYMax(), STEPS_GOAL) + 2000);
|
||||
|
||||
BarData barData = new BarData(set);
|
||||
barData.setValueTextColor(Color.GRAY); //prevent tearing other graph elements with the black text. Another approach would be to hide the values cmpletely with data.setDrawValues(false);
|
||||
|
Loading…
Reference in New Issue
Block a user