summaryrefslogtreecommitdiffstats
path: root/qt-ui/profile/divecartesianaxis.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/profile/divecartesianaxis.cpp')
-rw-r--r--qt-ui/profile/divecartesianaxis.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/qt-ui/profile/divecartesianaxis.cpp b/qt-ui/profile/divecartesianaxis.cpp
index 08138408e..a7721561c 100644
--- a/qt-ui/profile/divecartesianaxis.cpp
+++ b/qt-ui/profile/divecartesianaxis.cpp
@@ -143,15 +143,16 @@ qreal DiveCartesianAxis::posAtValue(qreal value)
QPointF p = pos();
double size = max - min;
- double percent = value / size;
+ double distanceFromOrigin = value - min;
+ double percent = (value - min) / size;
double realSize = orientation == Qt::Horizontal ?
m.x2() - m.x1() :
m.y2() - m.y1();
double retValue = realSize * percent;
- retValue = (orientation == Qt::Horizontal) ?
+ double adjusted = (orientation == Qt::Horizontal) ?
retValue + m.x1() + p.x() :
retValue + m.y1() + p.y();
- return retValue;
+ return adjusted;
}
qreal DiveCartesianAxis::percentAt(const QPointF& p)
@@ -192,6 +193,12 @@ QString TimeAxis::textForValue(double value)
return QString::number(value / 60);
}
+QString TemperatureAxis::textForValue(double value)
+{
+ return QString::number(mkelvin_to_C( (int) value));
+}
+
+
void DiveCartesianPlane::setLeftAxis(DiveCartesianAxis* axis)
{
leftAxis = axis;