Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get maximum of heart rate and use 110% for y axis of heart rate graph #873

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions app/src/main/org/runnerup/util/GraphWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import android.os.Build;
import android.preference.PreferenceManager;
import android.util.Log;
import android.util.Pair;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
Expand Down Expand Up @@ -104,6 +105,14 @@ public String formatLabel(double value, boolean isValueX) {
graphView2.getViewport().setScalable(true);
graphView2.getViewport().setScrollable(true);

// Get maximum of heart rate and use 110% for y axis
HRZones hrZones = new HRZones(context);
HRZoneCalculator hrZoneCalculator = new HRZoneCalculator(context);
int zoneCount = hrZoneCalculator.getZoneCount();
Pair<Integer, Integer> values = hrZones.getHRValues(zoneCount);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If no zone is set, this will return null, must add a check.

graphView2.getViewport().setMaxY(values.second*1.1);
graphView2.getViewport().setYAxisBoundsManual(true);

hrzonesBar = new HRZonesBar(context);
}

Expand Down