##// 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);
@@ -27,7 +27,22 SOURCES += \
27 27 $$PWD/multiaxis/multivalueaxis3.cpp \
28 28 $$PWD/multiaxis/multivalueaxis4.cpp \
29 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 47 !linux-arm*: {
33 48 SOURCES += \
@@ -48,7 +48,7 public:
48 48 // generate random data
49 49 for (int i(0); i < listCount; i++) {
50 50 DataList dataList;
51 qreal yValue(0);
51 qreal yValue(0.1);
52 52 for (int j(0); j < valueCount; j++) {
53 53 yValue = yValue + (qreal)(qrand() % valueMax) / (qreal) valueCount;
54 54 QPointF value(
General Comments 0
You need to be logged in to leave comments. Login now