Skip to content
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
Copy Markdown
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