From 0cbe39e834e2f8bcd7d598a2fa5ce5138eb8dd22 Mon Sep 17 00:00:00 2001 From: Sean Rhea Date: Sun, 20 Sep 2009 21:22:47 -0700 Subject: [PATCH] allow altitude plot to go below zero Also ensure that altitude axis is at least 100 feet/meters tall to avoid making a flat course look hilly. --- src/AllPlot.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/AllPlot.cpp b/src/AllPlot.cpp index c8778bc27..7a3e7985d 100644 --- a/src/AllPlot.cpp +++ b/src/AllPlot.cpp @@ -455,7 +455,10 @@ AllPlot::setYMax() } if (altCurve->isVisible()) { setAxisTitle(yRight2, useMetricUnits ? "Meters" : "Feet"); - setAxisScale(yRight2, 0.0, 1.05 * altCurve->maxYValue()); + double ymin = altCurve->minYValue(); + double ymax = qMax(ymin + 100, 1.05 * altCurve->maxYValue()); + setAxisScale(yRight2, ymin, ymax); + altCurve->setBaseline(ymin); } enableAxis(yLeft, wattsCurve->isVisible()); @@ -524,10 +527,9 @@ AllPlot::setData(RideItem *_rideItem) if (!cadArray.empty()) cadArray[arrayLength] = max(0, point->cad); if (!altArray.empty()) - altArray[arrayLength] = max(0, - (useMetricUnits - ? point->alt - : point->alt * FEET_PER_M)); + altArray[arrayLength] = (useMetricUnits + ? point->alt + : point->alt * FEET_PER_M); interArray[arrayLength] = point->interval; distanceArray[arrayLength] = max(0, (useMetricUnits