##// END OF EJS Templates
chartviewer: changed log bases in some charts
Marek Rosa -
r2291:d0fa2a6e848f
parent child
Show More
@@ -1,62 +1,62
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 #include "charts.h"
21 #include "charts.h"
22 #include "qchart.h"
22 #include "qchart.h"
23 #include "qlineseries.h"
23 #include "qlineseries.h"
24 #include "qlogvalueaxis.h"
24 #include "qlogvalueaxis.h"
25 #include "qvalueaxis.h"
25 #include "qvalueaxis.h"
26
26
27 class LineLogXY: public Chart
27 class LineLogXY: public Chart
28 {
28 {
29 public:
29 public:
30 QString name() { return "Line LogX Y"; }
30 QString name() { return "Line LogX Y"; }
31 QString category() { return QObject::tr("Domain"); }
31 QString category() { return QObject::tr("Domain"); }
32 QString subCategory() { return QObject::tr("Both Log"); }
32 QString subCategory() { return QObject::tr("Both Log"); }
33
33
34 QChart *createChart(const DataTable &table)
34 QChart *createChart(const DataTable &table)
35 {
35 {
36 QChart *chart = new QChart();
36 QChart *chart = new QChart();
37 chart->setTitle("Line: Log X, Y");
37 chart->setTitle("Line: Log X, Y");
38
38
39 QString name("Series ");
39 QString name("Series ");
40 int nameIndex = 0;
40 int nameIndex = 0;
41 foreach (DataList list, table) {
41 foreach (DataList list, table) {
42 QLineSeries *series = new QLineSeries(chart);
42 QLineSeries *series = new QLineSeries(chart);
43 foreach (Data data, list)
43 foreach (Data data, list)
44 series->append(data.first);
44 series->append(data.first);
45 series->setName(name + QString::number(nameIndex));
45 series->setName(name + QString::number(nameIndex));
46 nameIndex++;
46 nameIndex++;
47 chart->addSeries(series);
47 chart->addSeries(series);
48 }
48 }
49
49
50 QLogValueAxis *axisX= new QLogValueAxis();
50 QLogValueAxis *axisX= new QLogValueAxis();
51 axisX->setBase(1.2);
51 axisX->setBase(2);
52 QValueAxis *axisY= new QValueAxis();
52 QValueAxis *axisY= new QValueAxis();
53 foreach (QAbstractSeries *series, chart->series()) {
53 foreach (QAbstractSeries *series, chart->series()) {
54 chart->setAxisX(axisX, series);
54 chart->setAxisX(axisX, series);
55 chart->setAxisY(axisY, series);
55 chart->setAxisY(axisY, series);
56 }
56 }
57
57
58 return chart;
58 return chart;
59 }
59 }
60 };
60 };
61
61
62 DECLARE_CHART(LineLogXY);
62 DECLARE_CHART(LineLogXY);
@@ -1,62 +1,62
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 #include "charts.h"
21 #include "charts.h"
22 #include "qchart.h"
22 #include "qchart.h"
23 #include "qscatterseries.h"
23 #include "qscatterseries.h"
24 #include "qlogvalueaxis.h"
24 #include "qlogvalueaxis.h"
25
25
26 class ScatterLogXLogY: public Chart
26 class ScatterLogXLogY: public Chart
27 {
27 {
28 public:
28 public:
29 QString name() { return "Scatter LogX LogY"; }
29 QString name() { return "Scatter LogX LogY"; }
30 QString category() { return QObject::tr("Domain"); }
30 QString category() { return QObject::tr("Domain"); }
31 QString subCategory() { return QObject::tr("Both Log"); }
31 QString subCategory() { return QObject::tr("Both Log"); }
32
32
33 QChart *createChart(const DataTable &table)
33 QChart *createChart(const DataTable &table)
34 {
34 {
35 QChart *chart = new QChart();
35 QChart *chart = new QChart();
36 chart->setTitle("Scatter: Log X, Log Y");
36 chart->setTitle("Scatter: Log X, Log Y");
37
37
38 QString name("Series ");
38 QString name("Series ");
39 int nameIndex = 0;
39 int nameIndex = 0;
40 foreach (DataList list, table) {
40 foreach (DataList list, table) {
41 QScatterSeries *series = new QScatterSeries(chart);
41 QScatterSeries *series = new QScatterSeries(chart);
42 foreach (Data data, list)
42 foreach (Data data, list)
43 series->append(data.first);
43 series->append(data.first);
44 series->setName(name + QString::number(nameIndex));
44 series->setName(name + QString::number(nameIndex));
45 nameIndex++;
45 nameIndex++;
46 chart->addSeries(series);
46 chart->addSeries(series);
47 }
47 }
48
48
49 QLogValueAxis *axisX= new QLogValueAxis();
49 QLogValueAxis *axisX= new QLogValueAxis();
50 axisX->setBase(1.2);
50 axisX->setBase(2);
51 QLogValueAxis *axisY= new QLogValueAxis();
51 QLogValueAxis *axisY= new QLogValueAxis();
52 axisY->setBase(2);
52 axisY->setBase(2);
53 foreach (QAbstractSeries *series, chart->series()) {
53 foreach (QAbstractSeries *series, chart->series()) {
54 chart->setAxisX(axisX, series);
54 chart->setAxisX(axisX, series);
55 chart->setAxisY(axisY, series);
55 chart->setAxisY(axisY, series);
56 }
56 }
57
57
58 return chart;
58 return chart;
59 }
59 }
60 };
60 };
61
61
62 DECLARE_CHART(ScatterLogXLogY);
62 DECLARE_CHART(ScatterLogXLogY);
@@ -1,62 +1,62
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 #include "charts.h"
21 #include "charts.h"
22 #include "qchart.h"
22 #include "qchart.h"
23 #include "qscatterseries.h"
23 #include "qscatterseries.h"
24 #include "qlogvalueaxis.h"
24 #include "qlogvalueaxis.h"
25 #include "qvalueaxis.h"
25 #include "qvalueaxis.h"
26
26
27 class ScatterLogXY: public Chart
27 class ScatterLogXY: public Chart
28 {
28 {
29 public:
29 public:
30 QString name() { return "Scatter LogX Y"; }
30 QString name() { return "Scatter LogX Y"; }
31 QString category() { return QObject::tr("Domain"); }
31 QString category() { return QObject::tr("Domain"); }
32 QString subCategory() { return QObject::tr("Both Log"); }
32 QString subCategory() { return QObject::tr("Both Log"); }
33
33
34 QChart *createChart(const DataTable &table)
34 QChart *createChart(const DataTable &table)
35 {
35 {
36 QChart *chart = new QChart();
36 QChart *chart = new QChart();
37 chart->setTitle("Scatter: Log X, Y");
37 chart->setTitle("Scatter: Log X, Y");
38
38
39 QString name("Series ");
39 QString name("Series ");
40 int nameIndex = 0;
40 int nameIndex = 0;
41 foreach (DataList list, table) {
41 foreach (DataList list, table) {
42 QScatterSeries *series = new QScatterSeries(chart);
42 QScatterSeries *series = new QScatterSeries(chart);
43 foreach (Data data, list)
43 foreach (Data data, list)
44 series->append(data.first);
44 series->append(data.first);
45 series->setName(name + QString::number(nameIndex));
45 series->setName(name + QString::number(nameIndex));
46 nameIndex++;
46 nameIndex++;
47 chart->addSeries(series);
47 chart->addSeries(series);
48 }
48 }
49
49
50 QLogValueAxis *axisX= new QLogValueAxis();
50 QLogValueAxis *axisX= new QLogValueAxis();
51 axisX->setBase(1.2);
51 axisX->setBase(2);
52 QValueAxis *axisY= new QValueAxis();
52 QValueAxis *axisY= new QValueAxis();
53 foreach (QAbstractSeries *series, chart->series()) {
53 foreach (QAbstractSeries *series, chart->series()) {
54 chart->setAxisX(axisX, series);
54 chart->setAxisX(axisX, series);
55 chart->setAxisY(axisY, series);
55 chart->setAxisY(axisY, series);
56 }
56 }
57
57
58 return chart;
58 return chart;
59 }
59 }
60 };
60 };
61
61
62 DECLARE_CHART(ScatterLogXY);
62 DECLARE_CHART(ScatterLogXY);
@@ -1,62 +1,62
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 #include "charts.h"
21 #include "charts.h"
22 #include "qchart.h"
22 #include "qchart.h"
23 #include "qsplineseries.h"
23 #include "qsplineseries.h"
24 #include "qlogvalueaxis.h"
24 #include "qlogvalueaxis.h"
25
25
26 class SplineLogXLogY: public Chart
26 class SplineLogXLogY: public Chart
27 {
27 {
28 public:
28 public:
29 QString name() { return "Spline LogX LogY"; }
29 QString name() { return "Spline LogX LogY"; }
30 QString category() { return QObject::tr("Domain"); }
30 QString category() { return QObject::tr("Domain"); }
31 QString subCategory() { return QObject::tr("Both Log"); }
31 QString subCategory() { return QObject::tr("Both Log"); }
32
32
33 QChart *createChart(const DataTable &table)
33 QChart *createChart(const DataTable &table)
34 {
34 {
35 QChart *chart = new QChart();
35 QChart *chart = new QChart();
36 chart->setTitle("Spline: Log X, Log Y");
36 chart->setTitle("Spline: Log X, Log Y");
37
37
38 QString name("Series ");
38 QString name("Series ");
39 int nameIndex = 0;
39 int nameIndex = 0;
40 foreach (DataList list, table) {
40 foreach (DataList list, table) {
41 QSplineSeries *series = new QSplineSeries(chart);
41 QSplineSeries *series = new QSplineSeries(chart);
42 foreach (Data data, list)
42 foreach (Data data, list)
43 series->append(data.first);
43 series->append(data.first);
44 series->setName(name + QString::number(nameIndex));
44 series->setName(name + QString::number(nameIndex));
45 nameIndex++;
45 nameIndex++;
46 chart->addSeries(series);
46 chart->addSeries(series);
47 }
47 }
48
48
49 QLogValueAxis *axisX= new QLogValueAxis();
49 QLogValueAxis *axisX= new QLogValueAxis();
50 axisX->setBase(1.2);
50 axisX->setBase(2);
51 QLogValueAxis *axisY= new QLogValueAxis();
51 QLogValueAxis *axisY= new QLogValueAxis();
52 axisY->setBase(2);
52 axisY->setBase(2);
53 foreach (QAbstractSeries *series, chart->series()) {
53 foreach (QAbstractSeries *series, chart->series()) {
54 chart->setAxisX(axisX, series);
54 chart->setAxisX(axisX, series);
55 chart->setAxisY(axisY, series);
55 chart->setAxisY(axisY, series);
56 }
56 }
57
57
58 return chart;
58 return chart;
59 }
59 }
60 };
60 };
61
61
62 DECLARE_CHART(SplineLogXLogY);
62 DECLARE_CHART(SplineLogXLogY);
@@ -1,62 +1,62
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 #include "charts.h"
21 #include "charts.h"
22 #include "qchart.h"
22 #include "qchart.h"
23 #include "qsplineseries.h"
23 #include "qsplineseries.h"
24 #include "qlogvalueaxis.h"
24 #include "qlogvalueaxis.h"
25 #include "qvalueaxis.h"
25 #include "qvalueaxis.h"
26
26
27 class SplineLogXY: public Chart
27 class SplineLogXY: public Chart
28 {
28 {
29 public:
29 public:
30 QString name() { return "Spline LogX Y"; }
30 QString name() { return "Spline LogX Y"; }
31 QString category() { return QObject::tr("Domain"); }
31 QString category() { return QObject::tr("Domain"); }
32 QString subCategory() { return QObject::tr("Both Log"); }
32 QString subCategory() { return QObject::tr("Both Log"); }
33
33
34 QChart *createChart(const DataTable &table)
34 QChart *createChart(const DataTable &table)
35 {
35 {
36 QChart *chart = new QChart();
36 QChart *chart = new QChart();
37 chart->setTitle("Spline: Log X, Y");
37 chart->setTitle("Spline: Log X, Y");
38
38
39 QString name("Series ");
39 QString name("Series ");
40 int nameIndex = 0;
40 int nameIndex = 0;
41 foreach (DataList list, table) {
41 foreach (DataList list, table) {
42 QSplineSeries *series = new QSplineSeries(chart);
42 QSplineSeries *series = new QSplineSeries(chart);
43 foreach (Data data, list)
43 foreach (Data data, list)
44 series->append(data.first);
44 series->append(data.first);
45 series->setName(name + QString::number(nameIndex));
45 series->setName(name + QString::number(nameIndex));
46 nameIndex++;
46 nameIndex++;
47 chart->addSeries(series);
47 chart->addSeries(series);
48 }
48 }
49
49
50 QLogValueAxis *axisX= new QLogValueAxis();
50 QLogValueAxis *axisX= new QLogValueAxis();
51 axisX->setBase(1.2);
51 axisX->setBase(2);
52 QValueAxis *axisY= new QValueAxis();
52 QValueAxis *axisY= new QValueAxis();
53 foreach (QAbstractSeries *series, chart->series()) {
53 foreach (QAbstractSeries *series, chart->series()) {
54 chart->setAxisX(axisX, series);
54 chart->setAxisX(axisX, series);
55 chart->setAxisY(axisY, series);
55 chart->setAxisY(axisY, series);
56 }
56 }
57
57
58 return chart;
58 return chart;
59 }
59 }
60 };
60 };
61
61
62 DECLARE_CHART(SplineLogXY);
62 DECLARE_CHART(SplineLogXY);
General Comments 0
You need to be logged in to leave comments. Login now