summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorsauimone <samu.uimonen@digia.com>2012-07-03 17:12:39 +0300
committersauimone <samu.uimonen@digia.com>2012-07-03 17:12:39 +0300
commit2104eb1dd62b4786e92c363a82e9daf34d714564 (patch)
tree9539c3df3bd6422e2261e2289cc992c1ef1c34e3 /examples
parentab53d7df7636c064fa7c542a3b9a4e29364426b3 (diff)
removed groupedbarchart example. fixed barchart example
Diffstat (limited to 'examples')
-rw-r--r--examples/barchart/main.cpp33
-rw-r--r--examples/examples.pro2
-rw-r--r--examples/groupedbarchart/groupedbarchart.pro6
-rw-r--r--examples/groupedbarchart/main.cpp92
4 files changed, 24 insertions, 109 deletions
diff --git a/examples/barchart/main.cpp b/examples/barchart/main.cpp
index d0f60f1e..ccedb8b4 100644
--- a/examples/barchart/main.cpp
+++ b/examples/barchart/main.cpp
@@ -24,6 +24,7 @@
#include <QBarSeries>
#include <QBarSet>
#include <QLegend>
+#include <QCategoriesAxis>
QTCOMMERCIALCHART_USE_NAMESPACE
@@ -36,44 +37,56 @@ int main(int argc, char *argv[])
QBarSet *set1 = new QBarSet("John");
QBarSet *set2 = new QBarSet("Axel");
QBarSet *set3 = new QBarSet("Mary");
+ QBarSet *set4 = new QBarSet("Samantha");
- *set0 << QPointF(0.0, 1) << QPointF(1.0, 2) << QPointF(2.4, 3) << QPointF(3.0, 4) << QPointF(4.0, 5) << QPointF(5.0, 6);
- *set1 << QPointF(0.1, 2) << QPointF(1.2, 3) << QPointF(2.45, 4) << QPointF(3.2, 5) << QPointF(4.2, 6) << QPointF(5.2, 7);
- *set2 << QPointF(0.2, 3) << QPointF(1.4, 4) << QPointF(2.50, 5) << QPointF(3.4, 6) << QPointF(4.4, 7) << QPointF(5.4, 8);
- *set3 << QPointF(0.3, 4) << QPointF(1.6, 5) << QPointF(2.55, 6) << QPointF(3.6, 7) << QPointF(4.6, 8) << QPointF(5.6, 9);
+ *set0 << 1 << 2 << 3 << 4 << 5 << 6;
+ *set1 << 5 << 0 << 0 << 4 << 0 << 7;
+ *set2 << 3 << 5 << 8 << 13 << 8 << 5;
+ *set3 << 5 << 6 << 7 << 3 << 4 << 5;
+ *set4 << 9 << 7 << 5 << 3 << 1 << 2;
//![1]
//![2]
QBarSeries* series = new QBarSeries();
- series->setBarWidth(0.2);
series->append(set0);
series->append(set1);
series->append(set2);
series->append(set3);
+ series->append(set4);
+
//![2]
//![3]
QChart* chart = new QChart();
chart->addSeries(series);
chart->setTitle("Barchart example");
+ chart->createDefaultAxes();
//![3]
//![4]
- chart->legend()->setVisible(true);
- chart->legend()->setAlignment(Qt::AlignBottom);
+ QStringList categories;
+ categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
+ QCategoriesAxis* axis = new QCategoriesAxis();
+ axis->append(categories);
+ chart->setAxisX(axis,series);
//![4]
//![5]
- QChartView* chartView = new QChartView(chart);
- chartView->setRenderHint(QPainter::Antialiasing);
+ chart->legend()->setVisible(true);
+ chart->legend()->setAlignment(Qt::AlignBottom);
//![5]
//![6]
+ QChartView* chartView = new QChartView(chart);
+ chartView->setRenderHint(QPainter::Antialiasing);
+//![6]
+
+//![7]
QMainWindow window;
window.setCentralWidget(chartView);
window.resize(400, 300);
window.show();
-//![6]
+//![7]
return a.exec();
}
diff --git a/examples/examples.pro b/examples/examples.pro
index b89c21a4..d59d1ca8 100644
--- a/examples/examples.pro
+++ b/examples/examples.pro
@@ -19,7 +19,7 @@ SUBDIRS += \
stackedbarchartdrilldown \
zoomlinechart \
modeldata \
- groupedbarchart \
+ barchart \
legend \
barmodelmapper \
qmlpiechart
diff --git a/examples/groupedbarchart/groupedbarchart.pro b/examples/groupedbarchart/groupedbarchart.pro
deleted file mode 100644
index 26cd4b82..00000000
--- a/examples/groupedbarchart/groupedbarchart.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-!include( ../examples.pri ) {
- error( "Couldn't find the examples.pri file!" )
-}
-
-TARGET = groupedbarchart
-SOURCES += main.cpp
diff --git a/examples/groupedbarchart/main.cpp b/examples/groupedbarchart/main.cpp
deleted file mode 100644
index 828435ac..00000000
--- a/examples/groupedbarchart/main.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
-**
-** This file is part of the Qt Commercial Charts Add-on.
-**
-** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QMainWindow>
-#include <QChartView>
-#include <QBarSeries>
-#include <QBarSet>
-#include <QLegend>
-#include <QCategoriesAxis>
-
-QTCOMMERCIALCHART_USE_NAMESPACE
-
-int main(int argc, char *argv[])
-{
- QApplication a(argc, argv);
-
-//![1]
- QBarSet *set0 = new QBarSet("Jane");
- QBarSet *set1 = new QBarSet("John");
- QBarSet *set2 = new QBarSet("Axel");
- QBarSet *set3 = new QBarSet("Mary");
- QBarSet *set4 = new QBarSet("Samantha");
-
- *set0 << 1 << 2 << 3 << 4 << 5 << 6;
- *set1 << 5 << 0 << 0 << 4 << 0 << 7;
- *set2 << 3 << 5 << 8 << 13 << 8 << 5;
- *set3 << 5 << 6 << 7 << 3 << 4 << 5;
- *set4 << 9 << 7 << 5 << 3 << 1 << 2;
-//![1]
-
-//![2]
- QBarSeries* series = new QBarSeries();
- series->append(set0);
- series->append(set1);
- series->append(set2);
- series->append(set3);
- series->append(set4);
-
-//![2]
-
-//![3]
- QChart* chart = new QChart();
- chart->addSeries(series);
- chart->setTitle("Simple barchart example");
- chart->createDefaultAxes();
-//![3]
-
-//![4]
- QStringList categories;
- categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun";
- QCategoriesAxis* axis = new QCategoriesAxis();
- axis->append(categories);
- chart->setAxisX(axis,series);
-//![4]
-
-//![5]
- chart->legend()->setVisible(true);
- chart->legend()->setAlignment(Qt::AlignBottom);
-//![5]
-
-//![6]
- QChartView* chartView = new QChartView(chart);
- chartView->setRenderHint(QPainter::Antialiasing);
-//![6]
-
-//![7]
- QMainWindow window;
- window.setCentralWidget(chartView);
- window.resize(400, 300);
- window.show();
-//![7]
-
- return a.exec();
-}