private void refreshWeekBeforeSteps(
      DBHandler db, BarLineChartBase barChart, Calendar day, GBDevice device) {

    ActivityAnalysis analysis = new ActivityAnalysis();

    day = (Calendar) day.clone(); // do not modify the caller's argument
    day.add(Calendar.DATE, -7);
    List<BarEntry> entries = new ArrayList<>();
    List<String> labels = new ArrayList<>();

    for (int counter = 0; counter < 7; counter++) {
      entries.add(
          new BarEntry(analysis.calculateTotalSteps(getSamplesOfDay(db, day, device)), counter));
      labels.add(day.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.SHORT, mLocale));
      day.add(Calendar.DATE, 1);
    }

    BarDataSet set = new BarDataSet(entries, "");
    set.setColor(akActivity.color);

    BarData data = new BarData(labels, set);
    data.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);

    LimitLine target = new LimitLine(mTargetSteps);
    barChart.getAxisLeft().getLimitLines().clear();
    barChart.getAxisLeft().addLimitLine(target);

    setupLegend(barChart);
    barChart.setData(data);
    barChart.getLegend().setEnabled(false);
  }
  private void setupWeekStepsChart() {
    mWeekStepsChart.setBackgroundColor(BACKGROUND_COLOR);
    mWeekStepsChart.setDescriptionColor(DESCRIPTION_COLOR);
    mWeekStepsChart.setDescription("");

    configureBarLineChartDefaults(mWeekStepsChart);

    XAxis x = mWeekStepsChart.getXAxis();
    x.setDrawLabels(true);
    x.setDrawGridLines(false);
    x.setEnabled(true);
    x.setTextColor(CHART_TEXT_COLOR);
    x.setDrawLimitLinesBehindData(true);

    YAxis y = mWeekStepsChart.getAxisLeft();
    y.setDrawGridLines(false);
    y.setDrawTopYLabelEntry(false);
    y.setTextColor(CHART_TEXT_COLOR);

    y.setEnabled(true);

    YAxis yAxisRight = mWeekStepsChart.getAxisRight();
    yAxisRight.setDrawGridLines(false);
    yAxisRight.setEnabled(false);
    yAxisRight.setDrawLabels(false);
    yAxisRight.setDrawTopYLabelEntry(false);
    yAxisRight.setTextColor(CHART_TEXT_COLOR);
  }
 @Override
 protected void renderCharts() {
   mWeekStepsChart.invalidate();
   mTodayStepsChart.invalidate();
 }