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 all commits
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
14 changes: 14 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,19 @@ public String formatLabel(double value, boolean isValueX) {
graphView2.getViewport().setScalable(true);
graphView2.getViewport().setScrollable(true);

// Get min-/maximum of heart rate and use 90%/110% for y axis
HRZones hrZones = new HRZones(context);
HRZoneCalculator hrZoneCalculator = new HRZoneCalculator(context);
int zoneCount = hrZoneCalculator.getZoneCount();
Pair<Integer, Integer> MaxValues = hrZones.getHRValues(zoneCount);
Pair<Integer, Integer> MinValues = hrZones.getHRValues(1);
if(MaxValues != null && MinValues != null){
graphView2.getViewport().setMaxY(MaxValues.second*1.1);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be set in complete()

graphView2.getViewport().setMinY(MinValues.first*0.9);
graphView2.getViewport().setYAxisBoundsManual(true);
}


hrzonesBar = new HRZonesBar(context);
}

Expand Down