diff options
author | Tomi Korpipää <tomi.korpipaa@digia.com> | 2013-05-17 08:21:36 +0300 |
---|---|---|
committer | Tomi Korpipää <tomi.korpipaa@digia.com> | 2013-05-17 08:39:17 +0300 |
commit | 901d814f94ff502687cc36c94af6daf50c7d43eb (patch) | |
tree | ce533f2ca5ff690f57b1c5ec26474fffbda5f06a /examples/widget | |
parent | 64d9d0d2aed2b0046fc8aac8696484e7c6f9df21 (diff) |
Added support for setting tick count
Change-Id: I1dc92d0241d1ae64d0e515595edfaefb50cb22bd
Change-Id: I1dc92d0241d1ae64d0e515595edfaefb50cb22bd
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Diffstat (limited to 'examples/widget')
-rw-r--r-- | examples/widget/chart.cpp | 15 | ||||
-rw-r--r-- | examples/widget/chart.h | 3 |
2 files changed, 16 insertions, 2 deletions
diff --git a/examples/widget/chart.cpp b/examples/widget/chart.cpp index b5668ad1..741b04c7 100644 --- a/examples/widget/chart.cpp +++ b/examples/widget/chart.cpp @@ -55,7 +55,10 @@ ChartModifier::ChartModifier(Q3DBars *barchart) m_barDepth(1.0f), m_barSpacingX(0.1f), m_barSpacingZ(0.1f), - m_fontSize(20) + m_fontSize(20), + m_ticks(20), + m_tickStep(1), + m_minval(-15.2f) { // Don't set any styles or specifications, start from defaults } @@ -80,11 +83,14 @@ void ChartModifier::restart(bool dynamicData) // Set selection mode to zoom row m_chart->setSelectionMode(ModeZoomRow); m_chart->setFont(QFont("Times Roman", 20)); + m_chart->setTickCount(m_ticks, m_tickStep, m_minval); } else { - // Set up sample space; make it as deep as it's wide + // Set up sample space m_chart->setupSampleSpace(m_columnCount, m_rowCount); // Set selection mode to full m_chart->setSelectionMode(ModeBarRowAndColumn); + // Reset tick count to default + m_chart->setTickCount(0, 0); } } @@ -133,6 +139,11 @@ void ChartModifier::addDataSet() dataRow++; } + // Set tick count (4 steps of 5 degrees, with absolute minimum of -16C, even though we don't have quite that low temperatures in the data) + //m_chart->setTickCount(4, 5, -16.0f); + // ..or 20 steps of 1 degree, with absolute minimum of -15.2C + m_chart->setTickCount(m_ticks, m_tickStep, m_minval); + // Set up sample space based on prepared data m_chart->setupSampleSpace(months.size(), years.size()); diff --git a/examples/widget/chart.h b/examples/widget/chart.h index 48507a95..81b123e5 100644 --- a/examples/widget/chart.h +++ b/examples/widget/chart.h @@ -92,6 +92,9 @@ private: float m_barSpacingX; float m_barSpacingZ; int m_fontSize; + int m_ticks; + float m_tickStep; + float m_minval; }; #endif |