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/barchart | |
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/barchart')
-rw-r--r-- | examples/barchart/main.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/examples/barchart/main.cpp b/examples/barchart/main.cpp index 6887bb0b..48d77f1a 100644 --- a/examples/barchart/main.cpp +++ b/examples/barchart/main.cpp @@ -40,6 +40,7 @@ #include "q3dbars.h" #include "qdataset.h" +#include "qcategoryaxis.h" #include <QGuiApplication> #include <QScreen> @@ -229,12 +230,16 @@ void ChartDataGenerator::addDataSet() QDataSet *dataSet = new QDataSet(); // Add labels - dataSet->setLabels("Week of year", "Day of week", "Hours playing banjo", weeks, days); + m_chart->rowAxis()->setTitle("Week of year"); + m_chart->columnAxis()->setTitle("Day of week"); + m_chart->valueAxis()->setTitle("Hours playing banjo"); + m_chart->rowAxis()->setLabels(weeks); + m_chart->columnAxis()->setLabels(days); // Create data rows QDataRow *dataRow; for (int week = 0; week < weeks.size(); week++) { - dataRow = new QDataRow(weeks.at(week)); + dataRow = new QDataRow(); // Create data items for (int day = 0; day < days.size(); day++) { // Add data to rows |