diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2013-07-01 13:15:29 +0300 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2013-07-01 14:21:24 +0300 |
commit | 8ddb504c75949203c9982a3f6945b697b85c876d (patch) | |
tree | 60211955c2a6538270a74153e3ac069f70c261e1 /examples/widget | |
parent | 84ebb9cf116548d4304e6a9609b76f3c78698691 (diff) |
Decouple data and axes.
Note: Accessing same axes from renderer thread and main application
thread without mutexes is not cool. Axis handling needs further
thinking.
Change-Id: I5cfd9a095583012a9dccff0a1769916e3da19c22
Reviewed-by: Mika Salmela <mika.salmela@digia.com>
Diffstat (limited to 'examples/widget')
-rw-r--r-- | examples/widget/chart.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/examples/widget/chart.cpp b/examples/widget/chart.cpp index aa2b5424..84a25724 100644 --- a/examples/widget/chart.cpp +++ b/examples/widget/chart.cpp @@ -39,6 +39,8 @@ ****************************************************************************/ #include "chart.h" +#include "qcategoryaxis.h" +#include "qvalueaxis.h" using namespace QtDataVis3D; @@ -121,13 +123,16 @@ void ChartModifier::addDataSet() QDataSet *dataSet = new QDataSet(); // Add labels - dataSet->setLabels("Year", "Month", "Average temperature (" + celsiusString + ")", - years, months); + m_chart->rowAxis()->setTitle("Year"); + m_chart->columnAxis()->setTitle("Month"); + m_chart->valueAxis()->setTitle("Average temperature (" + celsiusString + ")"); + m_chart->rowAxis()->setLabels(years); + m_chart->columnAxis()->setLabels(months); // Create data rows QDataRow *dataRow; for (int year = 0; year < years.size(); year++) { - dataRow = new QDataRow(years.at(year)); + dataRow = new QDataRow(); // Create data items for (int month = 0; month < months.size(); month++) { // Add data to rows |