##// END OF EJS Templates
ChartViewer: added domain charts
Marek Rosa -
r2281:5dd68c268a20
parent child
Show More
@@ -0,0 +1,67
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 #include "charts.h"
22 #include "qchart.h"
23 #include "qhorizontalbarseries.h"
24 #include "qbarset.h"
25 #include "qlogvalueaxis.h"
26 #include "qbarcategoryaxis.h"
27
28 class BarLogX: public Chart
29 {
30 public:
31 QString name() { return "Horizontal Bar"; }
32 QString category() { return QObject::tr("Domain"); }
33 QString subCategory() { return "Horizontal Log"; }
34
35 QChart *createChart(const DataTable &table)
36 {
37 QChart *chart = new QChart();
38 chart->setTitle("Bar: Log X, BarCateogry Y");
39
40 QString name("Series ");
41 QHorizontalBarSeries *series = new QHorizontalBarSeries(chart);
42 QLogValueAxis *logvalueaxis = new QLogValueAxis();
43 logvalueaxis->setBase(2);
44 QBarCategoryAxis *barcategory = new QBarCategoryAxis();
45 for (int i(0); i < table.count(); i++) {
46 QBarSet *set = new QBarSet("Bar set " + QString::number(i));
47 foreach (Data data, table[i])
48 *set << data.first.y();
49 series->append(set);
50 }
51 chart->addSeries(series);
52
53 int count = series->barSets().first()->count();
54
55
56 for (int i = 0; i < count; i++) {
57 barcategory->append("BarSet " + QString::number(i));
58 }
59
60 chart->setAxisX(logvalueaxis, series);
61 chart->setAxisY(barcategory, series);
62
63 return chart;
64 }
65 };
66
67 DECLARE_CHART(BarLogX);
@@ -0,0 +1,67
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 #include "charts.h"
22 #include "qchart.h"
23 #include "qbarseries.h"
24 #include "qbarset.h"
25 #include "qlogvalueaxis.h"
26 #include "qbarcategoryaxis.h"
27
28 class BarLogY: public Chart
29 {
30 public:
31 QString name() { return "Bar"; }
32 QString category() { return QObject::tr("Domain"); }
33 QString subCategory() { return "Vertical Log"; }
34
35 QChart *createChart(const DataTable &table)
36 {
37 QChart *chart = new QChart();
38 chart->setTitle("Bar: BarCateogry X, Log Y");
39
40 QString name("Series ");
41 QBarSeries *series = new QBarSeries(chart);
42 QLogValueAxis *logvalueaxis = new QLogValueAxis();
43 logvalueaxis->setBase(2);
44 QBarCategoryAxis *barcategory = new QBarCategoryAxis();
45 for (int i(0); i < table.count(); i++) {
46 QBarSet *set = new QBarSet("Bar set " + QString::number(i));
47 foreach (Data data, table[i])
48 *set << data.first.y();
49 series->append(set);
50 }
51 chart->addSeries(series);
52
53 int count = series->barSets().first()->count();
54
55
56 for (int i = 0; i < count; i++) {
57 barcategory->append("BarSet " + QString::number(i));
58 }
59
60 chart->setAxisY(logvalueaxis, series);
61 chart->setAxisX(barcategory, series);
62
63 return chart;
64 }
65 };
66
67 DECLARE_CHART(BarLogY);
@@ -0,0 +1,67
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 #include "charts.h"
22 #include "qchart.h"
23 #include "qhorizontalpercentbarseries.h"
24 #include "qbarset.h"
25 #include "qlogvalueaxis.h"
26 #include "qbarcategoryaxis.h"
27
28 class BarPercentLogX: public Chart
29 {
30 public:
31 QString name() { return "Horizontal PercentBar"; }
32 QString category() { return QObject::tr("Domain"); }
33 QString subCategory() { return "Horizontal Log"; }
34
35 QChart *createChart(const DataTable &table)
36 {
37 QChart *chart = new QChart();
38 chart->setTitle("PercentBar: Log X, BarCateogry Y");
39
40 QString name("Series ");
41 QHorizontalPercentBarSeries *series = new QHorizontalPercentBarSeries(chart);
42 QLogValueAxis *logvalueaxis = new QLogValueAxis();
43 logvalueaxis->setBase(2);
44 QBarCategoryAxis *barcategory = new QBarCategoryAxis();
45 for (int i(0); i < table.count(); i++) {
46 QBarSet *set = new QBarSet("Bar set " + QString::number(i));
47 foreach (Data data, table[i])
48 *set << data.first.y();
49 series->append(set);
50 }
51 chart->addSeries(series);
52
53 int count = series->barSets().first()->count();
54
55
56 for (int i = 0; i < count; i++) {
57 barcategory->append("BarSet " + QString::number(i));
58 }
59
60 chart->setAxisX(logvalueaxis, series);
61 chart->setAxisY(barcategory, series);
62
63 return chart;
64 }
65 };
66
67 DECLARE_CHART(BarPercentLogX);
@@ -0,0 +1,67
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 #include "charts.h"
22 #include "qchart.h"
23 #include "qpercentbarseries.h"
24 #include "qbarset.h"
25 #include "qlogvalueaxis.h"
26 #include "qbarcategoryaxis.h"
27
28 class BarPercentLogY: public Chart
29 {
30 public:
31 QString name() { return "PercentBar"; }
32 QString category() { return QObject::tr("Domain"); }
33 QString subCategory() { return "Vertical Log"; }
34
35 QChart *createChart(const DataTable &table)
36 {
37 QChart *chart = new QChart();
38 chart->setTitle("PercentBar: BarCateogry X, Log Y");
39
40 QString name("Series ");
41 QPercentBarSeries *series = new QPercentBarSeries(chart);
42 QLogValueAxis *logvalueaxis = new QLogValueAxis();
43 logvalueaxis->setBase(2);
44 QBarCategoryAxis *barcategory = new QBarCategoryAxis();
45 for (int i(0); i < table.count(); i++) {
46 QBarSet *set = new QBarSet("Bar set " + QString::number(i));
47 foreach (Data data, table[i])
48 *set << data.first.y();
49 series->append(set);
50 }
51 chart->addSeries(series);
52
53 int count = series->barSets().first()->count();
54
55
56 for (int i = 0; i < count; i++) {
57 barcategory->append("BarSet " + QString::number(i));
58 }
59
60 chart->setAxisY(logvalueaxis, series);
61 chart->setAxisX(barcategory, series);
62
63 return chart;
64 }
65 };
66
67 DECLARE_CHART(BarPercentLogY);
@@ -0,0 +1,67
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 #include "charts.h"
22 #include "qchart.h"
23 #include "qhorizontalstackedbarseries.h"
24 #include "qbarset.h"
25 #include "qlogvalueaxis.h"
26 #include "qbarcategoryaxis.h"
27
28 class BarStackedLogX: public Chart
29 {
30 public:
31 QString name() { return "Horizontal StackedBar"; }
32 QString category() { return QObject::tr("Domain"); }
33 QString subCategory() { return "Horizontal Log"; }
34
35 QChart *createChart(const DataTable &table)
36 {
37 QChart *chart = new QChart();
38 chart->setTitle("StackedBar: Log X, BarCateogry Y");
39
40 QString name("Series ");
41 QHorizontalStackedBarSeries *series = new QHorizontalStackedBarSeries(chart);
42 QLogValueAxis *logvalueaxis = new QLogValueAxis();
43 logvalueaxis->setBase(2);
44 QBarCategoryAxis *barcategory = new QBarCategoryAxis();
45 for (int i(0); i < table.count(); i++) {
46 QBarSet *set = new QBarSet("Bar set " + QString::number(i));
47 foreach (Data data, table[i])
48 *set << data.first.y();
49 series->append(set);
50 }
51 chart->addSeries(series);
52
53 int count = series->barSets().first()->count();
54
55
56 for (int i = 0; i < count; i++) {
57 barcategory->append("BarSet " + QString::number(i));
58 }
59
60 chart->setAxisX(logvalueaxis, series);
61 chart->setAxisY(barcategory, series);
62
63 return chart;
64 }
65 };
66
67 DECLARE_CHART(BarStackedLogX);
@@ -0,0 +1,67
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 #include "charts.h"
22 #include "qchart.h"
23 #include "qstackedbarseries.h"
24 #include "qbarset.h"
25 #include "qlogvalueaxis.h"
26 #include "qbarcategoryaxis.h"
27
28 class BarStackedLogY: public Chart
29 {
30 public:
31 QString name() { return "StackedBar"; }
32 QString category() { return QObject::tr("Domain"); }
33 QString subCategory() { return "Vertical Log"; }
34
35 QChart *createChart(const DataTable &table)
36 {
37 QChart *chart = new QChart();
38 chart->setTitle("StackedBar: BarCateogry X, Log Y");
39
40 QString name("Series ");
41 QStackedBarSeries *series = new QStackedBarSeries(chart);
42 QLogValueAxis *logvalueaxis = new QLogValueAxis();
43 logvalueaxis->setBase(2);
44 QBarCategoryAxis *barcategory = new QBarCategoryAxis();
45 for (int i(0); i < table.count(); i++) {
46 QBarSet *set = new QBarSet("Bar set " + QString::number(i));
47 foreach (Data data, table[i])
48 *set << data.first.y();
49 series->append(set);
50 }
51 chart->addSeries(series);
52
53 int count = series->barSets().first()->count();
54
55
56 for (int i = 0; i < count; i++) {
57 barcategory->append("BarSet " + QString::number(i));
58 }
59
60 chart->setAxisY(logvalueaxis, series);
61 chart->setAxisX(barcategory, series);
62
63 return chart;
64 }
65 };
66
67 DECLARE_CHART(BarStackedLogY);
@@ -0,0 +1,62
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 #include "charts.h"
22 #include "qchart.h"
23 #include "qlineseries.h"
24 #include "qlogvalueaxis.h"
25
26 class LineLogXLogY: public Chart
27 {
28 public:
29 QString name() { return "Line LogX LogY"; }
30 QString category() { return QObject::tr("Domain"); }
31 QString subCategory() { return QObject::tr("Both Log"); }
32
33 QChart *createChart(const DataTable &table)
34 {
35 QChart *chart = new QChart();
36 chart->setTitle("Line: Log X, Log Y");
37
38 QString name("Series ");
39 int nameIndex = 0;
40 foreach (DataList list, table) {
41 QLineSeries *series = new QLineSeries(chart);
42 foreach (Data data, list)
43 series->append(data.first);
44 series->setName(name + QString::number(nameIndex));
45 nameIndex++;
46 chart->addSeries(series);
47 }
48
49 QLogValueAxis *axisX= new QLogValueAxis();
50 axisX->setBase(1.2);
51 QLogValueAxis *axisY= new QLogValueAxis();
52 axisY->setBase(2);
53 foreach (QAbstractSeries *series, chart->series()) {
54 chart->setAxisX(axisX, series);
55 chart->setAxisY(axisY, series);
56 }
57
58 return chart;
59 }
60 };
61
62 DECLARE_CHART(LineLogXLogY);
@@ -0,0 +1,62
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 #include "charts.h"
22 #include "qchart.h"
23 #include "qlineseries.h"
24 #include "qlogvalueaxis.h"
25 #include "qvalueaxis.h"
26
27 class LineLogXY: public Chart
28 {
29 public:
30 QString name() { return "Line LogX Y"; }
31 QString category() { return QObject::tr("Domain"); }
32 QString subCategory() { return QObject::tr("Both Log"); }
33
34 QChart *createChart(const DataTable &table)
35 {
36 QChart *chart = new QChart();
37 chart->setTitle("Line: Log X, Y");
38
39 QString name("Series ");
40 int nameIndex = 0;
41 foreach (DataList list, table) {
42 QLineSeries *series = new QLineSeries(chart);
43 foreach (Data data, list)
44 series->append(data.first);
45 series->setName(name + QString::number(nameIndex));
46 nameIndex++;
47 chart->addSeries(series);
48 }
49
50 QLogValueAxis *axisX= new QLogValueAxis();
51 axisX->setBase(1.2);
52 QValueAxis *axisY= new QValueAxis();
53 foreach (QAbstractSeries *series, chart->series()) {
54 chart->setAxisX(axisX, series);
55 chart->setAxisY(axisY, series);
56 }
57
58 return chart;
59 }
60 };
61
62 DECLARE_CHART(LineLogXY);
@@ -0,0 +1,62
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 #include "charts.h"
22 #include "qchart.h"
23 #include "qlineseries.h"
24 #include "qlogvalueaxis.h"
25 #include "qvalueaxis.h"
26
27 class LineXLogY: public Chart
28 {
29 public:
30 QString name() { return "Line X LogY"; }
31 QString category() { return QObject::tr("Domain"); }
32 QString subCategory() { return QObject::tr("Both Log"); }
33
34 QChart *createChart(const DataTable &table)
35 {
36 QChart *chart = new QChart();
37 chart->setTitle("Line: X, Log Y");
38
39 QString name("Series ");
40 int nameIndex = 0;
41 foreach (DataList list, table) {
42 QLineSeries *series = new QLineSeries(chart);
43 foreach (Data data, list)
44 series->append(data.first);
45 series->setName(name + QString::number(nameIndex));
46 nameIndex++;
47 chart->addSeries(series);
48 }
49
50 QValueAxis *axisX= new QValueAxis();
51 QLogValueAxis *axisY= new QLogValueAxis();
52 axisY->setBase(2);
53 foreach (QAbstractSeries *series, chart->series()) {
54 chart->setAxisX(axisX, series);
55 chart->setAxisY(axisY, series);
56 }
57
58 return chart;
59 }
60 };
61
62 DECLARE_CHART(LineXLogY);
@@ -0,0 +1,62
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 #include "charts.h"
22 #include "qchart.h"
23 #include "qscatterseries.h"
24 #include "qlogvalueaxis.h"
25
26 class ScatterLogXLogY: public Chart
27 {
28 public:
29 QString name() { return "Scatter LogX LogY"; }
30 QString category() { return QObject::tr("Domain"); }
31 QString subCategory() { return QObject::tr("Both Log"); }
32
33 QChart *createChart(const DataTable &table)
34 {
35 QChart *chart = new QChart();
36 chart->setTitle("Scatter: Log X, Log Y");
37
38 QString name("Series ");
39 int nameIndex = 0;
40 foreach (DataList list, table) {
41 QScatterSeries *series = new QScatterSeries(chart);
42 foreach (Data data, list)
43 series->append(data.first);
44 series->setName(name + QString::number(nameIndex));
45 nameIndex++;
46 chart->addSeries(series);
47 }
48
49 QLogValueAxis *axisX= new QLogValueAxis();
50 axisX->setBase(1.2);
51 QLogValueAxis *axisY= new QLogValueAxis();
52 axisY->setBase(2);
53 foreach (QAbstractSeries *series, chart->series()) {
54 chart->setAxisX(axisX, series);
55 chart->setAxisY(axisY, series);
56 }
57
58 return chart;
59 }
60 };
61
62 DECLARE_CHART(ScatterLogXLogY);
@@ -0,0 +1,62
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 #include "charts.h"
22 #include "qchart.h"
23 #include "qscatterseries.h"
24 #include "qlogvalueaxis.h"
25 #include "qvalueaxis.h"
26
27 class ScatterLogXY: public Chart
28 {
29 public:
30 QString name() { return "Scatter LogX Y"; }
31 QString category() { return QObject::tr("Domain"); }
32 QString subCategory() { return QObject::tr("Both Log"); }
33
34 QChart *createChart(const DataTable &table)
35 {
36 QChart *chart = new QChart();
37 chart->setTitle("Scatter: Log X, Y");
38
39 QString name("Series ");
40 int nameIndex = 0;
41 foreach (DataList list, table) {
42 QScatterSeries *series = new QScatterSeries(chart);
43 foreach (Data data, list)
44 series->append(data.first);
45 series->setName(name + QString::number(nameIndex));
46 nameIndex++;
47 chart->addSeries(series);
48 }
49
50 QLogValueAxis *axisX= new QLogValueAxis();
51 axisX->setBase(1.2);
52 QValueAxis *axisY= new QValueAxis();
53 foreach (QAbstractSeries *series, chart->series()) {
54 chart->setAxisX(axisX, series);
55 chart->setAxisY(axisY, series);
56 }
57
58 return chart;
59 }
60 };
61
62 DECLARE_CHART(ScatterLogXY);
@@ -0,0 +1,62
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 #include "charts.h"
22 #include "qchart.h"
23 #include "qscatterseries.h"
24 #include "qlogvalueaxis.h"
25 #include "qvalueaxis.h"
26
27 class ScatterXLogY: public Chart
28 {
29 public:
30 QString name() { return "Scatter X LogY"; }
31 QString category() { return QObject::tr("Domain"); }
32 QString subCategory() { return QObject::tr("Both Log"); }
33
34 QChart *createChart(const DataTable &table)
35 {
36 QChart *chart = new QChart();
37 chart->setTitle("Scatter: X, Log Y");
38
39 QString name("Series ");
40 int nameIndex = 0;
41 foreach (DataList list, table) {
42 QScatterSeries *series = new QScatterSeries(chart);
43 foreach (Data data, list)
44 series->append(data.first);
45 series->setName(name + QString::number(nameIndex));
46 nameIndex++;
47 chart->addSeries(series);
48 }
49
50 QValueAxis *axisX= new QValueAxis();
51 QLogValueAxis *axisY= new QLogValueAxis();
52 axisY->setBase(2);
53 foreach (QAbstractSeries *series, chart->series()) {
54 chart->setAxisX(axisX, series);
55 chart->setAxisY(axisY, series);
56 }
57
58 return chart;
59 }
60 };
61
62 DECLARE_CHART(ScatterXLogY);
@@ -0,0 +1,62
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 #include "charts.h"
22 #include "qchart.h"
23 #include "qsplineseries.h"
24 #include "qlogvalueaxis.h"
25
26 class SplineLogXLogY: public Chart
27 {
28 public:
29 QString name() { return "Spline LogX LogY"; }
30 QString category() { return QObject::tr("Domain"); }
31 QString subCategory() { return QObject::tr("Both Log"); }
32
33 QChart *createChart(const DataTable &table)
34 {
35 QChart *chart = new QChart();
36 chart->setTitle("Spline: Log X, Log Y");
37
38 QString name("Series ");
39 int nameIndex = 0;
40 foreach (DataList list, table) {
41 QSplineSeries *series = new QSplineSeries(chart);
42 foreach (Data data, list)
43 series->append(data.first);
44 series->setName(name + QString::number(nameIndex));
45 nameIndex++;
46 chart->addSeries(series);
47 }
48
49 QLogValueAxis *axisX= new QLogValueAxis();
50 axisX->setBase(1.2);
51 QLogValueAxis *axisY= new QLogValueAxis();
52 axisY->setBase(2);
53 foreach (QAbstractSeries *series, chart->series()) {
54 chart->setAxisX(axisX, series);
55 chart->setAxisY(axisY, series);
56 }
57
58 return chart;
59 }
60 };
61
62 DECLARE_CHART(SplineLogXLogY);
@@ -0,0 +1,62
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 #include "charts.h"
22 #include "qchart.h"
23 #include "qsplineseries.h"
24 #include "qlogvalueaxis.h"
25 #include "qvalueaxis.h"
26
27 class SplineLogXY: public Chart
28 {
29 public:
30 QString name() { return "Spline LogX Y"; }
31 QString category() { return QObject::tr("Domain"); }
32 QString subCategory() { return QObject::tr("Both Log"); }
33
34 QChart *createChart(const DataTable &table)
35 {
36 QChart *chart = new QChart();
37 chart->setTitle("Spline: Log X, Y");
38
39 QString name("Series ");
40 int nameIndex = 0;
41 foreach (DataList list, table) {
42 QSplineSeries *series = new QSplineSeries(chart);
43 foreach (Data data, list)
44 series->append(data.first);
45 series->setName(name + QString::number(nameIndex));
46 nameIndex++;
47 chart->addSeries(series);
48 }
49
50 QLogValueAxis *axisX= new QLogValueAxis();
51 axisX->setBase(1.2);
52 QValueAxis *axisY= new QValueAxis();
53 foreach (QAbstractSeries *series, chart->series()) {
54 chart->setAxisX(axisX, series);
55 chart->setAxisY(axisY, series);
56 }
57
58 return chart;
59 }
60 };
61
62 DECLARE_CHART(SplineLogXY);
@@ -0,0 +1,62
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 #include "charts.h"
22 #include "qchart.h"
23 #include "qsplineseries.h"
24 #include "qlogvalueaxis.h"
25 #include "qvalueaxis.h"
26
27 class SplineXLogY: public Chart
28 {
29 public:
30 QString name() { return "Spline X LogY"; }
31 QString category() { return QObject::tr("Domain"); }
32 QString subCategory() { return QObject::tr("Both Log"); }
33
34 QChart *createChart(const DataTable &table)
35 {
36 QChart *chart = new QChart();
37 chart->setTitle("Spline: X, Log Y");
38
39 QString name("Series ");
40 int nameIndex = 0;
41 foreach (DataList list, table) {
42 QSplineSeries *series = new QSplineSeries(chart);
43 foreach (Data data, list)
44 series->append(data.first);
45 series->setName(name + QString::number(nameIndex));
46 nameIndex++;
47 chart->addSeries(series);
48 }
49
50 QValueAxis *axisX= new QValueAxis();
51 QLogValueAxis *axisY= new QLogValueAxis();
52 axisY->setBase(2);
53 foreach (QAbstractSeries *series, chart->series()) {
54 chart->setAxisX(axisX, series);
55 chart->setAxisY(axisY, series);
56 }
57
58 return chart;
59 }
60 };
61
62 DECLARE_CHART(SplineXLogY);
@@ -1,36 +1,51
1 INCLUDEPATH += $$PWD
1 INCLUDEPATH += $$PWD
2 DEPENDPATH += $$PWD
2 DEPENDPATH += $$PWD
3 SOURCES += \
3 SOURCES += \
4 $$PWD/font/font.cpp \
4 $$PWD/font/font.cpp \
5 $$PWD/xyseries/linechart.cpp \
5 $$PWD/xyseries/linechart.cpp \
6 $$PWD/xyseries/scatterchart.cpp \
6 $$PWD/xyseries/scatterchart.cpp \
7 $$PWD/xyseries/splinechart.cpp \
7 $$PWD/xyseries/splinechart.cpp \
8 $$PWD/xyseries/areachart.cpp \
8 $$PWD/xyseries/areachart.cpp \
9 $$PWD/barseries/verticalstackedbarchart.cpp \
9 $$PWD/barseries/verticalstackedbarchart.cpp \
10 $$PWD/barseries/horizontalstackedbarchart.cpp \
10 $$PWD/barseries/horizontalstackedbarchart.cpp \
11 $$PWD/barseries/verticalbarchart.cpp \
11 $$PWD/barseries/verticalbarchart.cpp \
12 $$PWD/barseries/horizontalbarchart.cpp \
12 $$PWD/barseries/horizontalbarchart.cpp \
13 $$PWD/barseries/horizontalpercentbarchart.cpp \
13 $$PWD/barseries/horizontalpercentbarchart.cpp \
14 $$PWD/barseries/verticalpercentbarchart.cpp \
14 $$PWD/barseries/verticalpercentbarchart.cpp \
15 $$PWD/pieseries/piechart.cpp \
15 $$PWD/pieseries/piechart.cpp \
16 $$PWD/pieseries/donutchart.cpp \
16 $$PWD/pieseries/donutchart.cpp \
17 $$PWD/axis/valueaxis.cpp \
17 $$PWD/axis/valueaxis.cpp \
18 $$PWD/axis/logvalueaxisx.cpp \
18 $$PWD/axis/logvalueaxisx.cpp \
19 $$PWD/axis/logvalueaxisy.cpp \
19 $$PWD/axis/logvalueaxisy.cpp \
20 $$PWD/axis/categoryaxis.cpp \
20 $$PWD/axis/categoryaxis.cpp \
21 $$PWD/axis/barcategoryaxisx.cpp \
21 $$PWD/axis/barcategoryaxisx.cpp \
22 $$PWD/axis/barcategoryaxisy.cpp \
22 $$PWD/axis/barcategoryaxisy.cpp \
23 $$PWD/axis/barcategoryaxisxlogy.cpp \
23 $$PWD/axis/barcategoryaxisxlogy.cpp \
24 $$PWD/axis/barcategoryaxisylogx.cpp \
24 $$PWD/axis/barcategoryaxisylogx.cpp \
25 $$PWD/multiaxis/multivalueaxis.cpp \
25 $$PWD/multiaxis/multivalueaxis.cpp \
26 $$PWD/multiaxis/multivalueaxis2.cpp \
26 $$PWD/multiaxis/multivalueaxis2.cpp \
27 $$PWD/multiaxis/multivalueaxis3.cpp \
27 $$PWD/multiaxis/multivalueaxis3.cpp \
28 $$PWD/multiaxis/multivalueaxis4.cpp \
28 $$PWD/multiaxis/multivalueaxis4.cpp \
29 $$PWD/multiaxis/multivaluebaraxis.cpp \
29 $$PWD/multiaxis/multivaluebaraxis.cpp \
30 $$PWD/size/sizecharts.cpp
30 $$PWD/size/sizecharts.cpp \
31 $$PWD/domain/barlogy.cpp \
32 $$PWD/domain/barlogx.cpp \
33 $$PWD/domain/barstackedlogy.cpp \
34 $$PWD/domain/barstackedlogx.cpp \
35 $$PWD/domain/barpercentlogy.cpp \
36 $$PWD/domain/barpercentlogx.cpp \
37 $$PWD/domain/linelogxlogy.cpp \
38 $$PWD/domain/linelogxy.cpp \
39 $$PWD/domain/linexlogy.cpp \
40 $$PWD/domain/splinelogxlogy.cpp \
41 $$PWD/domain/splinelogxy.cpp \
42 $$PWD/domain/splinexlogy.cpp \
43 $$PWD/domain/scatterlogxlogy.cpp \
44 $$PWD/domain/scatterlogxy.cpp \
45 $$PWD/domain/scatterxlogy.cpp
31
46
32 !linux-arm*: {
47 !linux-arm*: {
33 SOURCES += \
48 SOURCES += \
34 $$PWD/axis/datetimeaxisx.cpp \
49 $$PWD/axis/datetimeaxisx.cpp \
35 $$PWD/axis/datetimeaxisy.cpp
50 $$PWD/axis/datetimeaxisy.cpp
36 }
51 }
@@ -1,66 +1,66
1 /****************************************************************************
1 /****************************************************************************
2 **
2 **
3 ** Copyright (C) 2012 Digia Plc
3 ** Copyright (C) 2012 Digia Plc
4 ** All rights reserved.
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
6 **
7 ** This file is part of the Qt Commercial Charts Add-on.
7 ** This file is part of the Qt Commercial Charts Add-on.
8 **
8 **
9 ** $QT_BEGIN_LICENSE$
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Commercial licenses may use this file in
10 ** Licensees holding valid Qt Commercial licenses may use this file in
11 ** accordance with the Qt Commercial License Agreement provided with the
11 ** accordance with the Qt Commercial License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
13 ** a written agreement between you and Digia.
14 **
14 **
15 ** If you have questions regarding the use of this file, please use
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
17 ** $QT_END_LICENSE$
18 **
18 **
19 ****************************************************************************/
19 ****************************************************************************/
20
20
21 #ifndef MODEL_H
21 #ifndef MODEL_H
22 #define MODEL_H
22 #define MODEL_H
23
23
24 #include <QList>
24 #include <QList>
25 #include <QPair>
25 #include <QPair>
26 #include <QPointF>
26 #include <QPointF>
27 #include <QTime>
27 #include <QTime>
28 #include <stdlib.h>
28 #include <stdlib.h>
29
29
30 typedef QPair<QPointF, QString> Data;
30 typedef QPair<QPointF, QString> Data;
31 typedef QList<Data> DataList;
31 typedef QList<Data> DataList;
32 typedef QList<DataList> DataTable;
32 typedef QList<DataList> DataTable;
33
33
34
34
35 class Model
35 class Model
36 {
36 {
37 private:
37 private:
38 Model() {}
38 Model() {}
39
39
40 public:
40 public:
41 static DataTable generateRandomData(int listCount, int valueMax, int valueCount)
41 static DataTable generateRandomData(int listCount, int valueMax, int valueCount)
42 {
42 {
43 DataTable dataTable;
43 DataTable dataTable;
44
44
45 // set seed for random stuff
45 // set seed for random stuff
46 qsrand(QTime(0, 0, 0).secsTo(QTime::currentTime()));
46 qsrand(QTime(0, 0, 0).secsTo(QTime::currentTime()));
47
47
48 // generate random data
48 // generate random data
49 for (int i(0); i < listCount; i++) {
49 for (int i(0); i < listCount; i++) {
50 DataList dataList;
50 DataList dataList;
51 qreal yValue(0);
51 qreal yValue(0.1);
52 for (int j(0); j < valueCount; j++) {
52 for (int j(0); j < valueCount; j++) {
53 yValue = yValue + (qreal)(qrand() % valueMax) / (qreal) valueCount;
53 yValue = yValue + (qreal)(qrand() % valueMax) / (qreal) valueCount;
54 QPointF value(
54 QPointF value(
55 (j + (qreal) qrand() / (qreal) RAND_MAX)
55 (j + (qreal) qrand() / (qreal) RAND_MAX)
56 * ((qreal) valueMax / (qreal) valueCount), yValue);
56 * ((qreal) valueMax / (qreal) valueCount), yValue);
57 QString label = "Slice " + QString::number(i) + ":" + QString::number(j);
57 QString label = "Slice " + QString::number(i) + ":" + QString::number(j);
58 dataList << Data(value, label);
58 dataList << Data(value, label);
59 }
59 }
60 dataTable << dataList;
60 dataTable << dataList;
61 }
61 }
62 return dataTable;
62 return dataTable;
63 }
63 }
64 };
64 };
65
65
66 #endif
66 #endif
General Comments 0
You need to be logged in to leave comments. Login now