summaryrefslogtreecommitdiffstats
path: root/src/datavis3d/engine/axisrendercache.cpp
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2013-08-07 14:52:28 +0300
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2013-08-08 08:21:37 +0300
commitebee290095f9a32dbcf5956e9fed50d2610cbfe1 (patch)
treec9260232aa82517c12bbcd94ef3d004b29860959 /src/datavis3d/engine/axisrendercache.cpp
parentb3e10fcc8403bc1a0d9d4c107b52eb10af0ecffa (diff)
Tickcount and both automatic and explicit range setting via axes
- Tick count moved to QValueAxis. - QValueAxis adjusts range to data by default on barcharts. - QValueaxis explicit range setting now works for barchart. Change-Id: I2c0afcab34b74a848144fda41d9135dcdb510354 Reviewed-by: Tomi Korpipää <tomi.korpipaa@digia.com>
Diffstat (limited to 'src/datavis3d/engine/axisrendercache.cpp')
-rw-r--r--src/datavis3d/engine/axisrendercache.cpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/datavis3d/engine/axisrendercache.cpp b/src/datavis3d/engine/axisrendercache.cpp
index 4997ed80..a5466aba 100644
--- a/src/datavis3d/engine/axisrendercache.cpp
+++ b/src/datavis3d/engine/axisrendercache.cpp
@@ -47,7 +47,8 @@ AxisRenderCache::AxisRenderCache()
: m_type(QAbstractAxis::AxisTypeNone),
m_min(0.0),
m_max(0.0),
- m_drawer(0)
+ m_drawer(0),
+ m_tickStep(0.0f)
{
}
@@ -112,6 +113,24 @@ void AxisRenderCache::setLabels(const QStringList &labels)
}
}
+void AxisRenderCache::setMin(qreal min)
+{
+ m_min = min;
+ updateTickStep();
+}
+
+void AxisRenderCache::setMax(qreal max)
+{
+ m_max = max;
+ updateTickStep();
+}
+
+void AxisRenderCache::setTickCount(int count)
+{
+ m_tickCount = count;
+ updateTickStep();
+}
+
void AxisRenderCache::updateTextures()
{
if (m_title.isEmpty())
@@ -127,4 +146,13 @@ void AxisRenderCache::updateTextures()
}
}
+void AxisRenderCache::updateTickStep()
+{
+ if (m_tickCount > 0)
+ m_tickStep = (m_max - m_min) / m_tickCount;
+ else
+ m_tickStep = 0.0f;
+
+}
+
QT_DATAVIS3D_END_NAMESPACE