##// END OF EJS Templates
Renamed to QtCommercialChart
Tero Ahola -
r30:ef99599d15b7
parent child
Show More
@@ -0,0 +1,9
1 message( "Configuring with QtCommercialChart addon..." )
2
3 INCLUDEPATH += $$[QT_INSTALL_HEADERS]/QtCommercialChart
4
5 CONFIG(debug, debug|release) {
6 LIBS += -lQtCommercialChartd
7 } else {
8 LIBS += -lQtCommercialChart
9 }
@@ -0,0 +1,25
1 #ifndef CHARTGLOBAL_H
2 #define CHARTGLOBAL_H
3
4 #define QTCOMMERCIALCHART_VERSION_STR "1.0"
5 #define QTCOMMERCIALCHART_VERSION 0x01
6
7 #if defined(QTCOMMERCIALCHART_LIBRARY)
8 # define QTCOMMERCIALCHART_EXPORT Q_DECL_EXPORT
9 #else
10 # define QTCOMMERCIALCHART_EXPORT Q_DECL_IMPORT
11 #endif
12
13 #define QTCOMMERCIALCHART_NAMESPACE QtCommercialChart
14
15 #ifdef QTCOMMERCIALCHART_NAMESPACE
16 # define QTCOMMERCIALCHART_BEGIN_NAMESPACE namespace QTCOMMERCIALCHART_NAMESPACE {
17 # define QTCOMMERCIALCHART_END_NAMESPACE }
18 # define QTCOMMERCIALCHART_USE_NAMESPACE using namespace QTCOMMERCIALCHART_NAMESPACE;
19 #else
20 # define QTCOMMERCIALCHART_BEGIN_NAMESPACE
21 # define QTCOMMERCIALCHART_END_NAMESPACE
22 # define QTCOMMERCIALCHART_USE_NAMESPACE
23 #endif
24
25 #endif
@@ -1,11 +1,10
1 TEMPLATE = subdirs
1 TEMPLATE = subdirs
2 SUBDIRS += src #qmlplugin
2 SUBDIRS += src #qmlplugin
3
3
4 QMAKE_CXXFLAGS += -g -Wall
4 QMAKE_CXXFLAGS += -g -Wall
5 QMAKE_DISTCLEAN += -r build
5 QMAKE_DISTCLEAN += -r build
6
6
7 # install feature file
7 # install feature file
8 feature.path = $$[QT_INSTALL_DATA]/mkspecs/features
8 feature.path = $$[QT_INSTALL_DATA]/mkspecs/features
9 feature.files = $$PWD/features/charts.prf
9 feature.files = $$PWD/features/qtcommercialchart.prf
10 INSTALLS += feature
10 INSTALLS += feature
11
@@ -1,8 +1,8
1 TARGET = lineChart
1 TARGET = lineChart
2 TEMPLATE = app
2 TEMPLATE = app
3
3
4 QT += core gui
4 QT += core gui
5
5
6 CONFIG += charts
6 CONFIG += qtcommercialchart
7
7
8 SOURCES += main.cpp
8 SOURCES += main.cpp
@@ -1,55 +1,55
1 #include <QApplication>
1 #include <QApplication>
2 #include <QMainWindow>
2 #include <QMainWindow>
3 #include <qchartwidget.h>
3 #include <qchartwidget.h>
4 #include <qxychartseries.h>
4 #include <qxychartseries.h>
5 #include <qchart.h>
5 #include <qchart.h>
6 #include <cmath>
6 #include <cmath>
7
7
8 QCHART_USE_NAMESPACE
8 QTCOMMERCIALCHART_USE_NAMESPACE
9
9
10 #define PI 3.14159265358979
10 #define PI 3.14159265358979
11
11
12 int main(int argc, char *argv[])
12 int main(int argc, char *argv[])
13 {
13 {
14 QApplication a(argc, argv);
14 QApplication a(argc, argv);
15
15
16 QMainWindow window;
16 QMainWindow window;
17
17
18 QXYChartSeries* series0 = QXYChartSeries::create();
18 QXYChartSeries* series0 = QXYChartSeries::create();
19 series0->setColor(Qt::blue);
19 series0->setColor(Qt::blue);
20 QXYChartSeries* series1 = QXYChartSeries::create();
20 QXYChartSeries* series1 = QXYChartSeries::create();
21 series1->setColor(Qt::red);
21 series1->setColor(Qt::red);
22 QXYChartSeries* series2 = QXYChartSeries::create();
22 QXYChartSeries* series2 = QXYChartSeries::create();
23 series2->setColor(Qt::gray);
23 series2->setColor(Qt::gray);
24 QXYChartSeries* series3 = QXYChartSeries::create();
24 QXYChartSeries* series3 = QXYChartSeries::create();
25 series3->setColor(Qt::green);
25 series3->setColor(Qt::green);
26
26
27 int numPoints = 100;
27 int numPoints = 100;
28
28
29 for (int x = 0; x < numPoints; ++x) {
29 for (int x = 0; x < numPoints; ++x) {
30 series0->add(x,0);
30 series0->add(x,0);
31 series1->add(x, abs(sin(PI/50*x)*100));
31 series1->add(x, abs(sin(PI/50*x)*100));
32 series2->add(x, abs(cos(PI/50*x)*100));
32 series2->add(x, abs(cos(PI/50*x)*100));
33 series3->add(x,100);
33 series3->add(x,100);
34 }
34 }
35
35
36 QList<QXYChartSeries*> dataset;
36 QList<QXYChartSeries*> dataset;
37
37
38 //qDebug()<<"Series 1:" << *series1;
38 //qDebug()<<"Series 1:" << *series1;
39 //qDebug()<<"Series 2:" << *series2;
39 //qDebug()<<"Series 2:" << *series2;
40
40
41 dataset << series0;
41 dataset << series0;
42 dataset << series1;
42 dataset << series1;
43 dataset << series2;
43 dataset << series2;
44 dataset << series3;
44 dataset << series3;
45
45
46 QChartWidget* chartWidget = new QChartWidget(&window);
46 QChartWidget* chartWidget = new QChartWidget(&window);
47 chartWidget->addSeries(series1);
47 chartWidget->addSeries(series1);
48 chartWidget->addSeries(series2);
48 chartWidget->addSeries(series2);
49
49
50 window.setCentralWidget(chartWidget);
50 window.setCentralWidget(chartWidget);
51 window.resize(400, 300);
51 window.resize(400, 300);
52 window.show();
52 window.show();
53
53
54 return a.exec();
54 return a.exec();
55 }
55 }
@@ -1,50 +1,50
1 #include "axis_p.h"
1 #include "axis_p.h"
2 #include <QPainter>
2 #include <QPainter>
3 #include <QDebug>
3 #include <QDebug>
4
4
5 QCHART_BEGIN_NAMESPACE
5 QTCOMMERCIALCHART_BEGIN_NAMESPACE
6
6
7 Axis::Axis(QGraphicsItem* parent): QGraphicsItem(parent)
7 Axis::Axis(QGraphicsItem* parent): QGraphicsItem(parent)
8 {
8 {
9 }
9 }
10
10
11 Axis::~Axis()
11 Axis::~Axis()
12 {
12 {
13 }
13 }
14
14
15 void Axis::setLength(int length)
15 void Axis::setLength(int length)
16 {
16 {
17 QPainterPath path;
17 QPainterPath path;
18 path.moveTo(QPointF(0,0));
18 path.moveTo(QPointF(0,0));
19 path.lineTo(length,0);
19 path.lineTo(length,0);
20 // path.lineTo(length-4,0);
20 // path.lineTo(length-4,0);
21 // path.lineTo(length,3);
21 // path.lineTo(length,3);
22 // path.lineTo(length-4,6);
22 // path.lineTo(length-4,6);
23 // path.lineTo(length-4,4);
23 // path.lineTo(length-4,4);
24 // path.lineTo(0,4);
24 // path.lineTo(0,4);
25 // path.lineTo(0,2);
25 // path.lineTo(0,2);
26 m_path=path;
26 m_path=path;
27 update();
27 update();
28 }
28 }
29
29
30 QRectF Axis::boundingRect() const
30 QRectF Axis::boundingRect() const
31 {
31 {
32 return m_path.boundingRect();
32 return m_path.boundingRect();
33 }
33 }
34
34
35 QPainterPath Axis::shape() const
35 QPainterPath Axis::shape() const
36 {
36 {
37 return m_path;
37 return m_path;
38 }
38 }
39
39
40 void Axis::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,QWidget *widget)
40 void Axis::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,QWidget *widget)
41 {
41 {
42 painter->save();
42 painter->save();
43 QPen pen(Qt::black);
43 QPen pen(Qt::black);
44 //pen.setWidth(10);
44 //pen.setWidth(10);
45 painter->setPen(pen);
45 painter->setPen(pen);
46 painter->drawPath(m_path);
46 painter->drawPath(m_path);
47 painter->restore();
47 painter->restore();
48 }
48 }
49
49
50 QCHART_END_NAMESPACE
50 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,29 +1,29
1 #ifndef AXIS_H_
1 #ifndef AXIS_H_
2 #define AXIS_H_
2 #define AXIS_H_
3
3
4 #include <qchartconfig.h>
4 #include <qchartglobal.h>
5 #include <QGraphicsItem>
5 #include <QGraphicsItem>
6
6
7 QCHART_BEGIN_NAMESPACE
7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
8
8
9 class Axis: public QGraphicsItem
9 class Axis: public QGraphicsItem
10 {
10 {
11 public:
11 public:
12 Axis(QGraphicsItem* parent = 0);
12 Axis(QGraphicsItem* parent = 0);
13 virtual ~Axis();
13 virtual ~Axis();
14
14
15 //from QGraphicsItem
15 //from QGraphicsItem
16 virtual QPainterPath shape() const;
16 virtual QPainterPath shape() const;
17 virtual QRectF boundingRect() const;
17 virtual QRectF boundingRect() const;
18 virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
18 virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
19
19
20 void setLength(int length);
20 void setLength(int length);
21 void setWidth(int width);
21 void setWidth(int width);
22
22
23 private:
23 private:
24 QPainterPath m_path;
24 QPainterPath m_path;
25 };
25 };
26
26
27 QCHART_END_NAMESPACE
27 QTCOMMERCIALCHART_END_NAMESPACE
28
28
29 #endif /* AXIS_H_ */
29 #endif /* AXIS_H_ */
@@ -1,112 +1,114
1 #include "qchart.h"
1 #include "qchart.h"
2 #include "qchartseries.h"
2 #include "qchartseries.h"
3 #include "xylinechartitem_p.h"
3 #include "xylinechartitem_p.h"
4 #include "xyplotdomain_p.h"
4 #include "xyplotdomain_p.h"
5 #include "axis_p.h"
5 #include "axis_p.h"
6 #include "xygrid_p.h"
6 #include "xygrid_p.h"
7 #include <QDebug>
7 #include <QDebug>
8
8
9 QCHART_BEGIN_NAMESPACE
9 QTCOMMERCIALCHART_BEGIN_NAMESPACE
10
10
11 class QChartPrivate
11 class QChartPrivate
12 {
12 {
13 public:
13 public:
14
14
15 QChartPrivate(QChart* parent):
15 QChartPrivate(QChart* parent):
16 m_axisX(new Axis(parent)),
16 m_axisX(new Axis(parent)),
17 m_axisY(new Axis(parent)),
17 m_axisY(new Axis(parent)),
18 m_grid(new XYGrid(parent)),
18 m_grid(new XYGrid(parent)),
19 m_plotDataIndex(0),
19 m_plotDataIndex(0),
20 m_marginSize(0){}
20 m_marginSize(0){}
21
21
22 Axis* m_axisX;
22 Axis* m_axisX;
23 Axis* m_axisY;
23 Axis* m_axisY;
24 XYGrid* m_grid;
24 XYGrid* m_grid;
25 QRect m_rect;
25 QRect m_rect;
26 QList<const QChartSeries*> m_series;
26 QList<const QChartSeries*> m_series;
27 QList<XYPlotDomain> m_plotDataList;
27 QList<XYPlotDomain> m_plotDataList;
28 QList<QGraphicsItem*> m_items;
28 QList<QGraphicsItem*> m_items;
29 int m_plotDataIndex;
29 int m_plotDataIndex;
30 int m_marginSize;
30 int m_marginSize;
31
31
32 };
32 };
33
33
34 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
34 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
35
35
36 QChart::QChart(QGraphicsItem* parent):QGraphicsItem(parent),
36 QChart::QChart(QGraphicsItem* parent):QGraphicsItem(parent),
37 d_ptr(new QChartPrivate(this))
37 d_ptr(new QChartPrivate(this))
38 {
38 {
39 // setFlags(QGraphicsItem::ItemClipsChildrenToShape);
39 // setFlags(QGraphicsItem::ItemClipsChildrenToShape);
40 // set axis
40 // set axis
41 Q_D(QChart);
41 Q_D(QChart);
42 d->m_axisY->rotate(90);
42 d->m_axisY->rotate(90);
43
43
44 //TODO hardcoded values , to removed soon
44 //TODO hardcoded values , to removed soon
45 XYPlotDomain data;
45 XYPlotDomain data;
46 data.m_minX = 0.0;
46 data.m_minX = 0.0;
47 data.m_maxX = 100.0;
47 data.m_maxX = 100.0;
48 data.m_minY = 0.0;
48 data.m_minY = 0.0;
49 data.m_maxY = 100.0;
49 data.m_maxY = 100.0;
50 data.m_ticksX=4;
50 data.m_ticksX=4;
51 data.m_ticksY=4;
51 data.m_ticksY=4;
52
52
53 d->m_plotDataList.clear();
53 d->m_plotDataList.clear();
54 d->m_plotDataList << data;
54 d->m_plotDataList << data;
55
55
56 d->m_grid->setZValue(10);
56 d->m_grid->setZValue(10);
57 d->m_grid->setXYPlotData(d->m_plotDataList.at(0));
57 d->m_grid->setXYPlotData(d->m_plotDataList.at(0));
58 }
58 }
59
59
60 QChart::~QChart(){}
60 QChart::~QChart(){}
61
61
62 QRectF QChart::boundingRect() const
62 QRectF QChart::boundingRect() const
63 {
63 {
64 Q_D(const QChart);
64 Q_D(const QChart);
65 return d->m_rect;
65 return d->m_rect;
66 }
66 }
67
67
68 void QChart::addSeries(QChartSeries* series)
68 void QChart::addSeries(QChartSeries* series)
69 {
69 {
70 Q_D(QChart);
70 Q_D(QChart);
71 d->m_series<<series;
71 d->m_series<<series;
72
72
73 switch(series->type())
73 switch(series->type())
74 {
74 {
75 case QChartSeries::LINE:
75 case QChartSeries::SeriesTypeLine: {
76 XYLineChartItem* item = new XYLineChartItem(reinterpret_cast<QXYChartSeries*>(series),this);
76 XYLineChartItem* item = new XYLineChartItem(reinterpret_cast<QXYChartSeries*>(series),this);
77 item->updateXYPlotData(d->m_plotDataList.at(0));
77 item->updateXYPlotData(d->m_plotDataList.at(0));
78 d->m_items<<item;
78 d->m_items<<item;
79 break;
79 break;
80 }
80 }
81 case QChartSeries::SeriesTypeScatter: {
82 break;
83 }
84 }
81 }
85 }
82
86
83 void QChart::setSize(const QSizeF& size)
87 void QChart::setSize(const QSizeF& size)
84 {
88 {
85 Q_D(QChart);
89 Q_D(QChart);
86 //TODO refactor to setGeometry
90 //TODO refactor to setGeometry
87 d->m_rect = QRect(QPoint(0,0),size.toSize());
91 d->m_rect = QRect(QPoint(0,0),size.toSize());
88 d->m_rect.adjust(margin(),margin(),-margin(),-margin());
92 d->m_rect.adjust(margin(),margin(),-margin(),-margin());
89 d->m_grid->setPos(d->m_rect.topLeft());
93 d->m_grid->setPos(d->m_rect.topLeft());
90 d->m_grid->setSize(d->m_rect.size());
94 d->m_grid->setSize(d->m_rect.size());
91 d->m_plotDataList[0].m_viewportRect = d->m_rect;
95 d->m_plotDataList[0].m_viewportRect = d->m_rect;
92 foreach(QGraphicsItem* item , d->m_items)
96 foreach(QGraphicsItem* item , d->m_items)
93 reinterpret_cast<XYLineChartItem*>(item)->updateXYPlotData(d->m_plotDataList.at(0));
97 reinterpret_cast<XYLineChartItem*>(item)->updateXYPlotData(d->m_plotDataList.at(0));
94 update();
98 update();
95
99
96 }
100 }
97
101
98 int QChart::margin() const
102 int QChart::margin() const
99 {
103 {
100 Q_D(const QChart);
104 Q_D(const QChart);
101 return d->m_marginSize;
105 return d->m_marginSize;
102 }
106 }
103
107
104 void QChart::setMargin(int margin)
108 void QChart::setMargin(int margin)
105 {
109 {
106 Q_D(QChart);
110 Q_D(QChart);
107 d->m_marginSize = margin;
111 d->m_marginSize = margin;
108 }
112 }
109
113
110
114 QTCOMMERCIALCHART_END_NAMESPACE
111
112 QCHART_END_NAMESPACE
@@ -1,43 +1,43
1 #ifndef CHART_H
1 #ifndef CHART_H
2 #define CHART_H
2 #define CHART_H
3
3
4 #include <qchartconfig.h>
4 #include <qchartglobal.h>
5 #include <QGraphicsItem>
5 #include <QGraphicsItem>
6
6
7 QCHART_BEGIN_NAMESPACE
7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
8
8
9 class Axis;
9 class Axis;
10 class XYGrid;
10 class XYGrid;
11 class QChartSeries;
11 class QChartSeries;
12 class XYPlotDomain;
12 class XYPlotDomain;
13 class QChartPrivate;
13 class QChartPrivate;
14
14
15 class QCHART_EXPORT QChart : public QGraphicsItem
15 class QTCOMMERCIALCHART_EXPORT QChart : public QGraphicsItem
16 {
16 {
17
17
18 public:
18 public:
19 QChart(QGraphicsItem* parent = 0);
19 QChart(QGraphicsItem* parent = 0);
20 virtual ~QChart();
20 virtual ~QChart();
21
21
22 //from QGraphicsItem
22 //from QGraphicsItem
23 virtual QRectF boundingRect() const;
23 virtual QRectF boundingRect() const;
24 virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget){};
24 virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget){};
25
25
26 void addSeries(QChartSeries* series);
26 void addSeries(QChartSeries* series);
27
27
28 virtual void setSize(const QSizeF& rect);
28 virtual void setSize(const QSizeF& rect);
29 void setMargin(int margin);
29 void setMargin(int margin);
30 int margin() const;
30 int margin() const;
31
31
32 protected:
32 protected:
33 QChartPrivate * const d_ptr;
33 QChartPrivate * const d_ptr;
34
34
35 private:
35 private:
36 Q_DISABLE_COPY(QChart)
36 Q_DISABLE_COPY(QChart)
37 Q_DECLARE_PRIVATE(QChart)
37 Q_DECLARE_PRIVATE(QChart)
38
38
39 };
39 };
40
40
41 QCHART_END_NAMESPACE
41 QTCOMMERCIALCHART_END_NAMESPACE
42
42
43 #endif
43 #endif
@@ -1,31 +1,38
1 #ifndef QCHARTSERIES_H
1 #ifndef QCHARTSERIES_H
2 #define QCHARTSERIES_H
2 #define QCHARTSERIES_H
3
3
4 #include "qchartconfig.h"
4 #include "qchartglobal.h"
5 #include <QObject>
5 #include <QObject>
6
6
7 QCHART_BEGIN_NAMESPACE
7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
8
8
9 class QCHART_EXPORT QChartSeries : public QObject
9 class QTCOMMERCIALCHART_EXPORT QChartSeries : public QObject
10 {
10 {
11
11
12 public:
12 public:
13 enum QChartSeriesType {LINE,PIE,BAR};
13 enum QChartSeriesType {
14 SeriesTypeLine = 0,
15 // SeriesTypeArea,
16 // SeriesTypeBar,
17 // SeriesTypePie,
18 SeriesTypeScatter
19 // SeriesTypeSpline
20 };
14
21
15 protected:
22 protected:
16 QChartSeries(QObject *parent = 0):QObject(parent){};
23 QChartSeries(QObject *parent = 0):QObject(parent){};
17
24
18 public:
25 public:
19 virtual ~QChartSeries(){};
26 virtual ~QChartSeries(){};
20
27
21 //factory method
28 //factory method
22 static QChartSeries* create(QObject* parent = 0 ){ return 0;}
29 static QChartSeries* create(QObject* parent = 0 ){ return 0;}
23 //pure virtual
30 //pure virtual
24 virtual QChartSeriesType type() const = 0;
31 virtual QChartSeriesType type() const = 0;
25
32
26 };
33 };
27
34
28 QCHART_END_NAMESPACE
35 QTCOMMERCIALCHART_END_NAMESPACE
29
36
30 #endif
37 #endif
31
38
@@ -1,69 +1,69
1 #include "qchartwidget.h"
1 #include "qchartwidget.h"
2 #include "qchartseries.h"
2 #include "qchartseries.h"
3 #include <QGraphicsView>
3 #include <QGraphicsView>
4 #include <QGraphicsScene>
4 #include <QGraphicsScene>
5 #include <QResizeEvent>
5 #include <QResizeEvent>
6
6
7 QCHART_BEGIN_NAMESPACE
7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
8
8
9 class QChartWidgetPrivate
9 class QChartWidgetPrivate
10 {
10 {
11 public:
11 public:
12 QChartWidgetPrivate(QChartWidget *parent) :
12 QChartWidgetPrivate(QChartWidget *parent) :
13 m_view(0),
13 m_view(0),
14 m_scene(0),
14 m_scene(0),
15 m_chart(0)
15 m_chart(0)
16 {
16 {
17 m_scene = new QGraphicsScene();
17 m_scene = new QGraphicsScene();
18 m_view = new QGraphicsView(parent);
18 m_view = new QGraphicsView(parent);
19 m_view->setScene(m_scene);
19 m_view->setScene(m_scene);
20 m_chart = new QChart();
20 m_chart = new QChart();
21 m_scene->addItem(m_chart);
21 m_scene->addItem(m_chart);
22 }
22 }
23
23
24 ~QChartWidgetPrivate() {
24 ~QChartWidgetPrivate() {
25 }
25 }
26
26
27 QGraphicsView *m_view;
27 QGraphicsView *m_view;
28 QGraphicsScene *m_scene;
28 QGraphicsScene *m_scene;
29 QChart* m_chart;
29 QChart* m_chart;
30 };
30 };
31
31
32 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 ///////////////////////////////////////////////////////////////////////////////////////////////////
33
33
34 QChartWidget::QChartWidget(QWidget *parent) :
34 QChartWidget::QChartWidget(QWidget *parent) :
35 QWidget(parent),
35 QWidget(parent),
36 d_ptr(new QChartWidgetPrivate(this))
36 d_ptr(new QChartWidgetPrivate(this))
37 {
37 {
38 setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
38 setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
39 }
39 }
40
40
41 QChartWidget::~QChartWidget()
41 QChartWidget::~QChartWidget()
42 {
42 {
43 delete d_ptr;
43 delete d_ptr;
44 }
44 }
45
45
46 void QChartWidget::resizeEvent(QResizeEvent *event)
46 void QChartWidget::resizeEvent(QResizeEvent *event)
47 {
47 {
48 Q_D(QChartWidget);
48 Q_D(QChartWidget);
49 d->m_view->resize(size().width(),size().height());
49 d->m_view->resize(size().width(),size().height());
50 d->m_scene->setSceneRect(0,0,size().width(),size().height());
50 d->m_scene->setSceneRect(0,0,size().width(),size().height());
51 d->m_chart->setSize(size());
51 d->m_chart->setSize(size());
52 QWidget::resizeEvent(event);
52 QWidget::resizeEvent(event);
53 }
53 }
54
54
55 QSize QChartWidget::sizeHint() const
55 QSize QChartWidget::sizeHint() const
56 {
56 {
57 // TODO: calculate size hint based on contents?
57 // TODO: calculate size hint based on contents?
58 return QSize(100, 100);
58 return QSize(100, 100);
59 }
59 }
60
60
61 void QChartWidget::addSeries(QChartSeries* series)
61 void QChartWidget::addSeries(QChartSeries* series)
62 {
62 {
63 Q_D(QChartWidget);
63 Q_D(QChartWidget);
64 d->m_chart->addSeries(series);
64 d->m_chart->addSeries(series);
65 }
65 }
66
66
67 #include "moc_qchartwidget.cpp"
67 #include "moc_qchartwidget.cpp"
68
68
69 QCHART_END_NAMESPACE
69 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,36 +1,36
1 #ifndef QCHARTWIDGET_H
1 #ifndef QCHARTWIDGET_H
2 #define QCHARTWIDGET_H
2 #define QCHARTWIDGET_H
3
3
4 #include "qchartconfig.h"
4 #include "qchartglobal.h"
5 #include "qchart.h"
5 #include "qchart.h"
6 #include <QWidget>
6 #include <QWidget>
7
7
8 QCHART_BEGIN_NAMESPACE
8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
9
9
10 class QChartSeries;
10 class QChartSeries;
11 class QChartWidgetPrivate;
11 class QChartWidgetPrivate;
12
12
13 class QCHART_EXPORT QChartWidget : public QWidget
13 class QTCOMMERCIALCHART_EXPORT QChartWidget : public QWidget
14 {
14 {
15 Q_OBJECT
15 Q_OBJECT
16 public:
16 public:
17 explicit QChartWidget(QWidget *parent = 0);
17 explicit QChartWidget(QWidget *parent = 0);
18 ~QChartWidget();
18 ~QChartWidget();
19
19
20 //implement from QWidget
20 //implement from QWidget
21 void resizeEvent(QResizeEvent *event);
21 void resizeEvent(QResizeEvent *event);
22 QSize sizeHint() const;
22 QSize sizeHint() const;
23
23
24 void addSeries(QChartSeries* series);
24 void addSeries(QChartSeries* series);
25 protected:
25 protected:
26 QChartWidgetPrivate * const d_ptr;
26 QChartWidgetPrivate * const d_ptr;
27
27
28 private:
28 private:
29 Q_DISABLE_COPY(QChartWidget)
29 Q_DISABLE_COPY(QChartWidget)
30 Q_DECLARE_PRIVATE(QChartWidget)
30 Q_DECLARE_PRIVATE(QChartWidget)
31
31
32 };
32 };
33
33
34 QCHART_END_NAMESPACE
34 QTCOMMERCIALCHART_END_NAMESPACE
35
35
36 #endif // QCHARTWIDGET_H
36 #endif // QCHARTWIDGET_H
@@ -1,46 +1,49
1 TARGET = QChart
1 TARGET = QtCommercialChart
2 TEMPLATE = lib
2 TEMPLATE = lib
3 QT += core \
3 QT += core \
4 gui
4 gui
5 CONFIG += debug_and_release
5 CONFIG += debug_and_release
6 CONFIG(debug, debug|release):TARGET = QChartd
6 CONFIG(debug, debug|release):TARGET = QtCommercialChartd
7
7
8 SOURCES += \
8 SOURCES += \
9 xylinechart/qxychartseries.cpp \
9 xylinechart/qxychartseries.cpp \
10 xylinechart/xylinechartitem.cpp \
10 xylinechart/xylinechartitem.cpp \
11 xylinechart/xygrid.cpp \
11 xylinechart/xygrid.cpp \
12 xylinechart/xyplotdomain.cpp \
12 xylinechart/xyplotdomain.cpp \
13 qchart.cpp \
13 qchart.cpp \
14 axis.cpp \
14 axis.cpp \
15 qchartwidget.cpp
15 qchartwidget.cpp
16
16
17 PRIVATE_HEADERS += \
17 PRIVATE_HEADERS += \
18 xylinechart/xylinechartitem_p.h \
18 xylinechart/xylinechartitem_p.h \
19 xylinechart/xyplotdomain_p.h \
19 xylinechart/xyplotdomain_p.h \
20 xylinechart/xygrid_p.h \
20 xylinechart/xygrid_p.h \
21 axis_p.h
21 axis_p.h
22
22
23 PUBLIC_HEADERS += \
23 PUBLIC_HEADERS += \
24 qchartseries.h \
24 qchartseries.h \
25 qchart.h \
25 qchart.h \
26 qchartwidget.h \
26 qchartwidget.h \
27 qchartconfig.h \
27 qchartglobal.h \
28 xylinechart/qxychartseries.h
28 xylinechart/qxychartseries.h
29
29
30 HEADERS += $$PUBLIC_HEADERS
30 HEADERS += $$PUBLIC_HEADERS
31 HEADERS += $$PRIVATE_HEADERS
31 HEADERS += $$PRIVATE_HEADERS
32
32
33 INCLUDEPATH += xylinechart \
33 INCLUDEPATH += xylinechart \
34 .
34 .
35
35
36 OBJECTS_DIR = ../build/lib
36 OBJECTS_DIR = ../build/lib
37 MOC_DIR = ../build/lib
37 MOC_DIR = ../build/lib
38 UI_DIR = ../build/lib
38 UI_DIR = ../build/lib
39 RCC_DIR = ../build/lib
39 RCC_DIR = ../build/lib
40 DEFINES += QCHART_LIBRARY
40 DEFINES += QTCOMMERCIALCHART_LIBRARY
41
41
42 public_headers.path = $$[QT_INSTALL_HEADERS]/QCharts
42 public_headers.path = $$[QT_INSTALL_HEADERS]/QtCommercialChart
43 public_headers.files = $$PUBLIC_HEADERS
43 public_headers.files = $$PUBLIC_HEADERS
44 target.path = $$[QT_INSTALL_LIBS]
44 target.path = $$[QT_INSTALL_LIBS]
45 INSTALLS += target \
45 INSTALLS += target \
46 public_headers
46 public_headers
47
48
49
@@ -1,68 +1,68
1 #include "qxychartseries.h"
1 #include "qxychartseries.h"
2
2
3 QCHART_BEGIN_NAMESPACE
3 QTCOMMERCIALCHART_BEGIN_NAMESPACE
4
4
5 QXYChartSeries::QXYChartSeries(QObject* parent):QChartSeries(parent),
5 QXYChartSeries::QXYChartSeries(QObject* parent):QChartSeries(parent),
6 m_color(Qt::black)
6 m_color(Qt::black)
7 {
7 {
8 }
8 }
9
9
10 QXYChartSeries::~QXYChartSeries()
10 QXYChartSeries::~QXYChartSeries()
11 {
11 {
12 }
12 }
13
13
14 QXYChartSeries* QXYChartSeries::create(QObject* parent)
14 QXYChartSeries* QXYChartSeries::create(QObject* parent)
15 {
15 {
16 //TODO: here we take QChartData when it is ready
16 //TODO: here we take QChartData when it is ready
17 // return null if malformed;
17 // return null if malformed;
18 return new QXYChartSeries(parent);
18 return new QXYChartSeries(parent);
19 }
19 }
20
20
21 void QXYChartSeries::setColor(const QColor& color)
21 void QXYChartSeries::setColor(const QColor& color)
22 {
22 {
23 m_color = color;
23 m_color = color;
24 }
24 }
25
25
26 void QXYChartSeries::add(qreal x,qreal y)
26 void QXYChartSeries::add(qreal x,qreal y)
27 {
27 {
28 m_x<<x;
28 m_x<<x;
29 m_y<<y;
29 m_y<<y;
30 }
30 }
31
31
32 void QXYChartSeries::clear()
32 void QXYChartSeries::clear()
33 {
33 {
34 m_x.clear();
34 m_x.clear();
35 m_y.clear();
35 m_y.clear();
36 }
36 }
37
37
38 qreal QXYChartSeries::x(int pos) const
38 qreal QXYChartSeries::x(int pos) const
39 {
39 {
40 return m_x.at(pos);
40 return m_x.at(pos);
41 }
41 }
42
42
43 qreal QXYChartSeries::y(int pos) const
43 qreal QXYChartSeries::y(int pos) const
44 {
44 {
45 return m_y.at(pos);
45 return m_y.at(pos);
46 }
46 }
47
47
48 int QXYChartSeries::count() const
48 int QXYChartSeries::count() const
49 {
49 {
50 Q_ASSERT(m_x.size() == m_y.size());
50 Q_ASSERT(m_x.size() == m_y.size());
51
51
52 return m_x.size();
52 return m_x.size();
53
53
54 }
54 }
55
55
56 QDebug operator<< (QDebug debug, const QXYChartSeries series)
56 QDebug operator<< (QDebug debug, const QXYChartSeries series)
57 {
57 {
58 Q_ASSERT(series.m_x.size() == series.m_y.size());
58 Q_ASSERT(series.m_x.size() == series.m_y.size());
59
59
60 int size = series.m_x.size();
60 int size = series.m_x.size();
61
61
62 for (int i=0;i<size;i++) {
62 for (int i=0;i<size;i++) {
63 debug.nospace() << "(" << series.m_x.at(i) << ','<< series.m_y.at(i) << ") ";
63 debug.nospace() << "(" << series.m_x.at(i) << ','<< series.m_y.at(i) << ") ";
64 }
64 }
65 return debug.space();
65 return debug.space();
66 }
66 }
67
67
68 QCHART_END_NAMESPACE
68 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,40 +1,40
1 #ifndef QXYSERIES_H_
1 #ifndef QXYSERIES_H_
2 #define QXYSERIES_H_
2 #define QXYSERIES_H_
3
3
4 #include "qchartconfig.h"
4 #include "qchartglobal.h"
5 #include "qchartseries.h"
5 #include "qchartseries.h"
6 #include <QDebug>
6 #include <QDebug>
7 #include <QColor>
7 #include <QColor>
8
8
9 QCHART_BEGIN_NAMESPACE
9 QTCOMMERCIALCHART_BEGIN_NAMESPACE
10
10
11 class QCHART_EXPORT QXYChartSeries : public QChartSeries
11 class QTCOMMERCIALCHART_EXPORT QXYChartSeries : public QChartSeries
12 {
12 {
13 private:
13 private:
14 QXYChartSeries(QObject* parent=0);
14 QXYChartSeries(QObject* parent=0);
15 public:
15 public:
16 virtual ~QXYChartSeries();
16 virtual ~QXYChartSeries();
17
17
18 //implemented from QChartSeries
18 //implemented from QChartSeries
19 static QXYChartSeries* create(QObject* parent=0);
19 static QXYChartSeries* create(QObject* parent=0);
20 virtual QChartSeriesType type() const { return QChartSeries::LINE;};
20 virtual QChartSeriesType type() const { return QChartSeries::SeriesTypeLine;}
21
21
22 void add(qreal x, qreal y);
22 void add(qreal x, qreal y);
23 void clear();
23 void clear();
24 void setColor(const QColor& color);
24 void setColor(const QColor& color);
25 const QColor& color() const { return m_color;}
25 const QColor& color() const { return m_color;}
26 int count() const;
26 int count() const;
27 qreal x(int pos) const;
27 qreal x(int pos) const;
28 qreal y(int pos) const;
28 qreal y(int pos) const;
29 friend QDebug operator<< (QDebug d, const QXYChartSeries series);
29 friend QDebug operator<< (QDebug d, const QXYChartSeries series);
30
30
31 private:
31 private:
32 QColor m_color;
32 QColor m_color;
33 QList<qreal> m_x;
33 QList<qreal> m_x;
34 QList<qreal> m_y;
34 QList<qreal> m_y;
35
35
36 };
36 };
37
37
38 QCHART_END_NAMESPACE
38 QTCOMMERCIALCHART_END_NAMESPACE
39
39
40 #endif
40 #endif
@@ -1,70 +1,70
1 #include "xygrid_p.h"
1 #include "xygrid_p.h"
2 #include <QPainter>
2 #include <QPainter>
3 #include <QDebug>
3 #include <QDebug>
4
4
5 QCHART_BEGIN_NAMESPACE
5 QTCOMMERCIALCHART_BEGIN_NAMESPACE
6
6
7 XYGrid::XYGrid(QGraphicsItem* parent):QGraphicsItem(parent)
7 XYGrid::XYGrid(QGraphicsItem* parent):QGraphicsItem(parent)
8 {
8 {
9 }
9 }
10
10
11 XYGrid::~XYGrid()
11 XYGrid::~XYGrid()
12 {
12 {
13 // TODO Auto-generated destructor stub
13 // TODO Auto-generated destructor stub
14 }
14 }
15
15
16 void XYGrid::setSize(const QSizeF& size)
16 void XYGrid::setSize(const QSizeF& size)
17 {
17 {
18 m_rect.setSize(size.toSize());
18 m_rect.setSize(size.toSize());
19 }
19 }
20
20
21 void XYGrid::setXYPlotData(const XYPlotDomain& xyPlotData)
21 void XYGrid::setXYPlotData(const XYPlotDomain& xyPlotData)
22 {
22 {
23 m_xyPlotData = xyPlotData;
23 m_xyPlotData = xyPlotData;
24 }
24 }
25
25
26 QRectF XYGrid::boundingRect() const
26 QRectF XYGrid::boundingRect() const
27 {
27 {
28 return m_rect;
28 return m_rect;
29 }
29 }
30
30
31 void XYGrid::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,QWidget *widget)
31 void XYGrid::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,QWidget *widget)
32 {
32 {
33
33
34 if (!m_rect.isValid())
34 if (!m_rect.isValid())
35 return;
35 return;
36
36
37 const qreal deltaX = (m_rect.width() -1) / m_xyPlotData.ticksX();
37 const qreal deltaX = (m_rect.width() -1) / m_xyPlotData.ticksX();
38 const qreal deltaY = (m_rect.height() - 1) / m_xyPlotData.ticksY();
38 const qreal deltaY = (m_rect.height() - 1) / m_xyPlotData.ticksY();
39
39
40 for (int i = 0; i <= m_xyPlotData.ticksX(); ++i) {
40 for (int i = 0; i <= m_xyPlotData.ticksX(); ++i) {
41
41
42 int x = i * deltaX + m_rect.left();
42 int x = i * deltaX + m_rect.left();
43 qreal label = m_xyPlotData.m_minX + (i * m_xyPlotData.spanX()
43 qreal label = m_xyPlotData.m_minX + (i * m_xyPlotData.spanX()
44 / m_xyPlotData.ticksX());
44 / m_xyPlotData.ticksX());
45 painter->drawLine(x, m_rect.top()+1, x, m_rect.bottom());
45 painter->drawLine(x, m_rect.top()+1, x, m_rect.bottom());
46 //painter->drawLine(x, m_rect.bottom(), x, m_rect.bottom() + 5);
46 //painter->drawLine(x, m_rect.bottom(), x, m_rect.bottom() + 5);
47
47
48 painter->drawText(x - 50, m_rect.bottom() + 5, 100, 20,
48 painter->drawText(x - 50, m_rect.bottom() + 5, 100, 20,
49 Qt::AlignHCenter | Qt::AlignTop,
49 Qt::AlignHCenter | Qt::AlignTop,
50 QString::number(label));
50 QString::number(label));
51 }
51 }
52
52
53 for (int j = 0; j <= m_xyPlotData.ticksY(); ++j) {
53 for (int j = 0; j <= m_xyPlotData.ticksY(); ++j) {
54
54
55 int y = j * -deltaY + m_rect.bottom();
55 int y = j * -deltaY + m_rect.bottom();
56 qreal label = m_xyPlotData.m_minY + (j * m_xyPlotData.spanY()
56 qreal label = m_xyPlotData.m_minY + (j * m_xyPlotData.spanY()
57 / m_xyPlotData.ticksY());
57 / m_xyPlotData.ticksY());
58
58
59 painter->drawLine(m_rect.left(), y, m_rect.right()-1, y);
59 painter->drawLine(m_rect.left(), y, m_rect.right()-1, y);
60 //painter->drawLine(m_rect.left() - 5, y, m_rect.left(), y);
60 //painter->drawLine(m_rect.left() - 5, y, m_rect.left(), y);
61 //TODO : margin = 50 ;
61 //TODO : margin = 50 ;
62 painter->drawText(m_rect.left() - 50, y - 10, 50 - 5, 20,
62 painter->drawText(m_rect.left() - 50, y - 10, 50 - 5, 20,
63 Qt::AlignRight | Qt::AlignVCenter,
63 Qt::AlignRight | Qt::AlignVCenter,
64 QString::number(label));
64 QString::number(label));
65 }
65 }
66
66
67 //painter->drawRect(m_rect.adjusted(0, 0, -1, -1));
67 //painter->drawRect(m_rect.adjusted(0, 0, -1, -1));
68 }
68 }
69
69
70 QCHART_END_NAMESPACE
70 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,31 +1,31
1 #ifndef XYGRID_H_
1 #ifndef XYGRID_H_
2 #define XYGRID_H_
2 #define XYGRID_H_
3
3
4 #include <qchartconfig.h>
4 #include <qchartglobal.h>
5 #include <xyplotdomain_p.h>
5 #include <xyplotdomain_p.h>
6 #include <QGraphicsItem>
6 #include <QGraphicsItem>
7
7
8 QCHART_BEGIN_NAMESPACE
8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
9
9
10 class XYGrid : public QGraphicsItem
10 class XYGrid : public QGraphicsItem
11 {
11 {
12 public:
12 public:
13 XYGrid(QGraphicsItem* parent = 0);
13 XYGrid(QGraphicsItem* parent = 0);
14 virtual ~XYGrid();
14 virtual ~XYGrid();
15
15
16 //from QGraphicsItem
16 //from QGraphicsItem
17 virtual QRectF boundingRect() const;
17 virtual QRectF boundingRect() const;
18 virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
18 virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
19
19
20 //TODO: this is just temporary interface
20 //TODO: this is just temporary interface
21 void setXYPlotData(const XYPlotDomain& xyPlotData);
21 void setXYPlotData(const XYPlotDomain& xyPlotData);
22 void setSize(const QSizeF& rect);
22 void setSize(const QSizeF& rect);
23
23
24 private:
24 private:
25 QRectF m_rect;
25 QRectF m_rect;
26 XYPlotDomain m_xyPlotData;
26 XYPlotDomain m_xyPlotData;
27 };
27 };
28
28
29 QCHART_END_NAMESPACE
29 QTCOMMERCIALCHART_END_NAMESPACE
30
30
31 #endif /* XYGRID_H_ */
31 #endif /* XYGRID_H_ */
@@ -1,56 +1,56
1 #include "xylinechartitem_p.h"
1 #include "xylinechartitem_p.h"
2 #include "axis_p.h"
2 #include "axis_p.h"
3 #include "xygrid_p.h"
3 #include "xygrid_p.h"
4 #include "qxychartseries.h"
4 #include "qxychartseries.h"
5 #include <QPainter>
5 #include <QPainter>
6 #include <QStyleOptionGraphicsItem>
6 #include <QStyleOptionGraphicsItem>
7 #include <QDebug>
7 #include <QDebug>
8
8
9 QCHART_BEGIN_NAMESPACE
9 QTCOMMERCIALCHART_BEGIN_NAMESPACE
10
10
11 XYLineChartItem::XYLineChartItem(QXYChartSeries* series,QGraphicsItem *parent):QGraphicsItem(parent),
11 XYLineChartItem::XYLineChartItem(QXYChartSeries* series,QGraphicsItem *parent):QGraphicsItem(parent),
12 m_series(series)
12 m_series(series)
13 {
13 {
14
14
15 }
15 }
16
16
17 void XYLineChartItem::updateXYPlotData(const XYPlotDomain& data)
17 void XYLineChartItem::updateXYPlotData(const XYPlotDomain& data)
18 {
18 {
19 m_xyPlotData=data;
19 m_xyPlotData=data;
20
20
21 if (!m_xyPlotData.m_viewportRect.isValid())
21 if (!m_xyPlotData.m_viewportRect.isValid())
22 return;
22 return;
23
23
24 const QRect& rect = m_xyPlotData.m_viewportRect;
24 const QRect& rect = m_xyPlotData.m_viewportRect;
25
25
26 const qreal deltaX = (rect.width()-1)/m_xyPlotData.spanX();
26 const qreal deltaX = (rect.width()-1)/m_xyPlotData.spanX();
27 const qreal deltaY = (rect.height()-1)/m_xyPlotData.spanY();
27 const qreal deltaY = (rect.height()-1)/m_xyPlotData.spanY();
28
28
29 m_polyline.clear();
29 m_polyline.clear();
30 m_polyline.resize(m_series->count());
30 m_polyline.resize(m_series->count());
31
31
32 for (int j = 0; j < m_series->count(); ++j) {
32 for (int j = 0; j < m_series->count(); ++j) {
33 qreal dx = m_series->x(j) - m_xyPlotData.m_minX;
33 qreal dx = m_series->x(j) - m_xyPlotData.m_minX;
34 qreal dy = m_series->y(j) - m_xyPlotData.m_minY;
34 qreal dy = m_series->y(j) - m_xyPlotData.m_minY;
35 qreal x = (dx * deltaX) + rect.left();
35 qreal x = (dx * deltaX) + rect.left();
36 qreal y = - (dy * deltaY) + rect.bottom();
36 qreal y = - (dy * deltaY) + rect.bottom();
37 m_polyline[j] = QPointF(x, y);
37 m_polyline[j] = QPointF(x, y);
38 }
38 }
39
39
40 }
40 }
41
41
42 QRectF XYLineChartItem::boundingRect() const
42 QRectF XYLineChartItem::boundingRect() const
43 {
43 {
44 return m_polyline.boundingRect();
44 return m_polyline.boundingRect();
45 }
45 }
46
46
47
47
48 void XYLineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,QWidget *widget)
48 void XYLineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,QWidget *widget)
49 {
49 {
50 painter->setClipRect(m_xyPlotData.m_viewportRect.adjusted(+1, +1, -1, -1));
50 painter->setClipRect(m_xyPlotData.m_viewportRect.adjusted(+1, +1, -1, -1));
51 painter->setPen(m_series->color());
51 painter->setPen(m_series->color());
52 painter->drawPolyline(m_polyline);
52 painter->drawPolyline(m_polyline);
53
53
54 }
54 }
55
55
56 QCHART_END_NAMESPACE
56 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,33 +1,33
1 #ifndef XYLINECHARTITEM_H
1 #ifndef XYLINECHARTITEM_H
2 #define XYLINECHARTITEM_H
2 #define XYLINECHARTITEM_H
3
3
4 #include "qchartconfig.h"
4 #include "qchartglobal.h"
5 #include "qchart.h"
5 #include "qchart.h"
6 #include "xyplotdomain_p.h"
6 #include "xyplotdomain_p.h"
7
7
8 QCHART_BEGIN_NAMESPACE
8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
9
9
10 class QXYChartSeries;
10 class QXYChartSeries;
11
11
12 class XYLineChartItem : public QGraphicsItem
12 class XYLineChartItem : public QGraphicsItem
13 {
13 {
14
14
15 public:
15 public:
16 XYLineChartItem(QXYChartSeries* m_series,QGraphicsItem *parent = 0);
16 XYLineChartItem(QXYChartSeries* m_series,QGraphicsItem *parent = 0);
17 virtual ~ XYLineChartItem(){};
17 virtual ~ XYLineChartItem(){};
18
18
19 //from QGraphicsItem
19 //from QGraphicsItem
20 virtual QRectF boundingRect() const;
20 virtual QRectF boundingRect() const;
21 virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
21 virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
22
22
23 void updateXYPlotData(const XYPlotDomain& data);
23 void updateXYPlotData(const XYPlotDomain& data);
24
24
25 private:
25 private:
26 QPolygonF m_polyline;
26 QPolygonF m_polyline;
27 QXYChartSeries* m_series;
27 QXYChartSeries* m_series;
28 XYPlotDomain m_xyPlotData;
28 XYPlotDomain m_xyPlotData;
29 };
29 };
30
30
31 QCHART_END_NAMESPACE
31 QTCOMMERCIALCHART_END_NAMESPACE
32
32
33 #endif
33 #endif
@@ -1,33 +1,33
1 #include "xyplotdomain_p.h"
1 #include "xyplotdomain_p.h"
2
2
3 QCHART_BEGIN_NAMESPACE
3 QTCOMMERCIALCHART_BEGIN_NAMESPACE
4
4
5 XYPlotDomain::XYPlotDomain():
5 XYPlotDomain::XYPlotDomain():
6 m_ticksX(0),
6 m_ticksX(0),
7 m_ticksY(0),
7 m_ticksY(0),
8 m_minX(0),
8 m_minX(0),
9 m_maxX(0),
9 m_maxX(0),
10 m_minY(0),
10 m_minY(0),
11 m_maxY(0)
11 m_maxY(0)
12 {
12 {
13
13
14 }
14 }
15
15
16 XYPlotDomain::~XYPlotDomain()
16 XYPlotDomain::~XYPlotDomain()
17 {
17 {
18 // TODO Auto-generated destructor stub
18 // TODO Auto-generated destructor stub
19 }
19 }
20
20
21 qreal XYPlotDomain::spanX() const
21 qreal XYPlotDomain::spanX() const
22 {
22 {
23 Q_ASSERT(m_maxX >= m_minX);
23 Q_ASSERT(m_maxX >= m_minX);
24 return m_maxX - m_minX;
24 return m_maxX - m_minX;
25 }
25 }
26
26
27 qreal XYPlotDomain::spanY() const
27 qreal XYPlotDomain::spanY() const
28 {
28 {
29 Q_ASSERT(m_maxY >= m_minY);
29 Q_ASSERT(m_maxY >= m_minY);
30 return m_maxY - m_minY;
30 return m_maxY - m_minY;
31 }
31 }
32
32
33 QCHART_END_NAMESPACE
33 QTCOMMERCIALCHART_END_NAMESPACE
@@ -1,30 +1,30
1 #ifndef PLOTDOMAIN_H_
1 #ifndef PLOTDOMAIN_H_
2 #define PLOTDOMAIN_H_
2 #define PLOTDOMAIN_H_
3 #include "qchartconfig.h"
3 #include "qchartglobal.h"
4 #include <QRect>
4 #include <QRect>
5
5
6 QCHART_BEGIN_NAMESPACE
6 QTCOMMERCIALCHART_BEGIN_NAMESPACE
7
7
8 class XYPlotDomain {
8 class XYPlotDomain {
9 public:
9 public:
10 XYPlotDomain();
10 XYPlotDomain();
11 virtual ~XYPlotDomain();
11 virtual ~XYPlotDomain();
12
12
13 qreal spanX() const;
13 qreal spanX() const;
14 qreal spanY() const;
14 qreal spanY() const;
15 int ticksX() const { return m_ticksX; }
15 int ticksX() const { return m_ticksX; }
16 int ticksY() const { return m_ticksY; }
16 int ticksY() const { return m_ticksY; }
17
17
18 public:
18 public:
19 int m_ticksX;
19 int m_ticksX;
20 int m_ticksY;
20 int m_ticksY;
21 qreal m_minX;
21 qreal m_minX;
22 qreal m_maxX;
22 qreal m_maxX;
23 qreal m_minY;
23 qreal m_minY;
24 qreal m_maxY;
24 qreal m_maxY;
25 QRect m_viewportRect;
25 QRect m_viewportRect;
26 };
26 };
27
27
28 QCHART_END_NAMESPACE
28 QTCOMMERCIALCHART_END_NAMESPACE
29
29
30 #endif /* PLOTTER_H_ */
30 #endif /* PLOTTER_H_ */
@@ -1,33 +1,33
1 TARGET = chartwidgettest
1 TARGET = chartwidgettest
2 TEMPLATE = app
2 TEMPLATE = app
3
3
4 QT += core gui
4 QT += core gui
5 contains(QT_MAJOR_VERSION, 5) {
5 contains(QT_MAJOR_VERSION, 5) {
6 QT += widgets
6 QT += widgets
7 }
7 }
8
8
9 CONFIG += charts
9 CONFIG += qtcommercialchart
10
10
11 OBJECTS_DIR = tmp
11 OBJECTS_DIR = tmp
12 MOC_DIR = tmp
12 MOC_DIR = tmp
13
13
14 SOURCES += main.cpp \
14 SOURCES += main.cpp \
15 mainwidget.cpp \
15 mainwidget.cpp \
16 # qscatterseries.cpp \
16 # qscatterseries.cpp \
17 # qseriespointgraphicsitem.cpp \
17 # qseriespointgraphicsitem.cpp \
18 dataseriedialog.cpp
18 dataseriedialog.cpp
19
19
20 HEADERS += \
20 HEADERS += \
21 mainwidget.h \
21 mainwidget.h \
22 # qscatterseries.h \
22 # qscatterseries.h \
23 # qseriespointgraphicsitem.h \
23 # qseriespointgraphicsitem.h \
24 dataseriedialog.h
24 dataseriedialog.h
25
25
26
26
27
27
28
28
29
29
30
30
31
31
32
32
33
33
@@ -1,223 +1,225
1 #include "mainwidget.h"
1 #include "mainwidget.h"
2 #include "dataseriedialog.h"
2 #include "dataseriedialog.h"
3 #include <qxychartseries.h>
3 #include <qxychartseries.h>
4 #include <QPushButton>
4 #include <QPushButton>
5 #include <QComboBox>
5 #include <QComboBox>
6 #include <QSpinBox>
6 #include <QSpinBox>
7 #include <QCheckBox>
7 #include <QCheckBox>
8 #include <QGridLayout>
8 #include <QGridLayout>
9 #include <QHBoxLayout>
9 #include <QHBoxLayout>
10 #include <QLabel>
10 #include <QLabel>
11 #include <QSpacerItem>
11 #include <QSpacerItem>
12 #include <QMessageBox>
12 #include <QMessageBox>
13 #include <cmath>
13 #include <cmath>
14 #include <QDebug>
14 #include <QDebug>
15
15
16 QCHART_USE_NAMESPACE
16 QTCOMMERCIALCHART_USE_NAMESPACE
17
17
18 MainWidget::MainWidget(QWidget *parent) :
18 MainWidget::MainWidget(QWidget *parent) :
19 QWidget(parent)
19 QWidget(parent)
20 {
20 {
21 m_chartWidget = new QChartWidget(this);
22 // m_chartWidget->resize(QSize(200,200));
23 // m_chartWidget->setColor(Qt::red);
24
25 QPushButton *addSeriesButton = new QPushButton("Add series");
21 QPushButton *addSeriesButton = new QPushButton("Add series");
26 connect(addSeriesButton, SIGNAL(clicked()), this, SLOT(addSeries()));
22 connect(addSeriesButton, SIGNAL(clicked()), this, SLOT(addSeries()));
27
23
28 // Chart background
24 // Chart background
29 QComboBox *backgroundCombo = new QComboBox(this);
25 QComboBox *backgroundCombo = new QComboBox(this);
30 backgroundCombo->addItem("None");
26 backgroundCombo->addItem("None");
31 backgroundCombo->addItem("TODO Grid");
27 backgroundCombo->addItem("TODO Grid");
32 backgroundCombo->addItem("TODO Image");
28 backgroundCombo->addItem("TODO Image");
33 connect(backgroundCombo, SIGNAL(currentIndexChanged(int)),
29 connect(backgroundCombo, SIGNAL(currentIndexChanged(int)),
34 this, SLOT(backgroundChanged(int)));
30 this, SLOT(backgroundChanged(int)));
35
31
36 // Axis
32 // Axis
37 // TODO: multiple axes?
33 // TODO: multiple axes?
38 m_autoScaleCheck = new QCheckBox("Automatic scaling");
34 m_autoScaleCheck = new QCheckBox("Automatic scaling");
39 connect(m_autoScaleCheck, SIGNAL(stateChanged(int)), this, SLOT(autoScaleChanged(int)));
35 connect(m_autoScaleCheck, SIGNAL(stateChanged(int)), this, SLOT(autoScaleChanged(int)));
40 // Allow setting also non-sense values (like -2147483648 and 2147483647)
36 // Allow setting also non-sense values (like -2147483648 and 2147483647)
41 m_xMinSpin = new QSpinBox();
37 m_xMinSpin = new QSpinBox();
42 m_xMinSpin->setMinimum(INT_MIN);
38 m_xMinSpin->setMinimum(INT_MIN);
43 m_xMinSpin->setMaximum(INT_MAX);
39 m_xMinSpin->setMaximum(INT_MAX);
44 m_xMinSpin->setValue(0);
40 m_xMinSpin->setValue(0);
45 connect(m_xMinSpin, SIGNAL(valueChanged(int)), this, SLOT(xMinChanged(int)));
41 connect(m_xMinSpin, SIGNAL(valueChanged(int)), this, SLOT(xMinChanged(int)));
46 m_xMaxSpin = new QSpinBox();
42 m_xMaxSpin = new QSpinBox();
47 m_xMaxSpin->setMinimum(INT_MIN);
43 m_xMaxSpin->setMinimum(INT_MIN);
48 m_xMaxSpin->setMaximum(INT_MAX);
44 m_xMaxSpin->setMaximum(INT_MAX);
49 m_xMaxSpin->setValue(10);
45 m_xMaxSpin->setValue(10);
50 connect(m_xMaxSpin, SIGNAL(valueChanged(int)), this, SLOT(xMaxChanged(int)));
46 connect(m_xMaxSpin, SIGNAL(valueChanged(int)), this, SLOT(xMaxChanged(int)));
51 m_yMinSpin = new QSpinBox();
47 m_yMinSpin = new QSpinBox();
52 m_yMinSpin->setMinimum(INT_MIN);
48 m_yMinSpin->setMinimum(INT_MIN);
53 m_yMinSpin->setMaximum(INT_MAX);
49 m_yMinSpin->setMaximum(INT_MAX);
54 m_yMinSpin->setValue(0);
50 m_yMinSpin->setValue(0);
55 connect(m_yMinSpin, SIGNAL(valueChanged(int)), this, SLOT(yMinChanged(int)));
51 connect(m_yMinSpin, SIGNAL(valueChanged(int)), this, SLOT(yMinChanged(int)));
56 m_yMaxSpin = new QSpinBox();
52 m_yMaxSpin = new QSpinBox();
57 m_yMaxSpin->setMinimum(INT_MIN);
53 m_yMaxSpin->setMinimum(INT_MIN);
58 m_yMaxSpin->setMaximum(INT_MAX);
54 m_yMaxSpin->setMaximum(INT_MAX);
59 m_yMaxSpin->setValue(10);
55 m_yMaxSpin->setValue(10);
60 connect(m_yMaxSpin, SIGNAL(valueChanged(int)), this, SLOT(yMaxChanged(int)));
56 connect(m_yMaxSpin, SIGNAL(valueChanged(int)), this, SLOT(yMaxChanged(int)));
61
57
62 QGridLayout *grid = new QGridLayout();
58 QGridLayout *grid = new QGridLayout();
63 QHBoxLayout *hbox = new QHBoxLayout();
59 QHBoxLayout *hbox = new QHBoxLayout();
64 //grid->addWidget(new QLabel("Add series:"), 0, 0);
60 //grid->addWidget(new QLabel("Add series:"), 0, 0);
65 grid->addWidget(addSeriesButton, 0, 1);
61 grid->addWidget(addSeriesButton, 0, 1);
66 grid->addWidget(new QLabel("Background:"), 2, 0);
62 grid->addWidget(new QLabel("Background:"), 2, 0);
67 grid->addWidget(backgroundCombo, 2, 1);
63 grid->addWidget(backgroundCombo, 2, 1);
68 grid->addWidget(m_autoScaleCheck, 3, 0);
64 grid->addWidget(m_autoScaleCheck, 3, 0);
69 grid->addWidget(new QLabel("x min:"), 4, 0);
65 grid->addWidget(new QLabel("x min:"), 4, 0);
70 grid->addWidget(m_xMinSpin, 4, 1);
66 grid->addWidget(m_xMinSpin, 4, 1);
71 grid->addWidget(new QLabel("x max:"), 5, 0);
67 grid->addWidget(new QLabel("x max:"), 5, 0);
72 grid->addWidget(m_xMaxSpin, 5, 1);
68 grid->addWidget(m_xMaxSpin, 5, 1);
73 grid->addWidget(new QLabel("y min:"), 6, 0);
69 grid->addWidget(new QLabel("y min:"), 6, 0);
74 grid->addWidget(m_yMinSpin, 6, 1);
70 grid->addWidget(m_yMinSpin, 6, 1);
75 grid->addWidget(new QLabel("y max:"), 7, 0);
71 grid->addWidget(new QLabel("y max:"), 7, 0);
76 grid->addWidget(m_yMaxSpin, 7, 1);
72 grid->addWidget(m_yMaxSpin, 7, 1);
77 // add row with empty label to make all the other rows static
73 // add row with empty label to make all the other rows static
78 grid->addWidget(new QLabel(""), 8, 0);
74 grid->addWidget(new QLabel(""), 8, 0);
79 grid->setRowStretch(8, 1);
75 grid->setRowStretch(8, 1);
80
76
81 hbox->addLayout(grid);
77 hbox->addLayout(grid);
78
79 m_chartWidget = new QChartWidget(this);
80 //m_chartWidget->setColor(Qt::red);
82 hbox->addWidget(m_chartWidget);
81 hbox->addWidget(m_chartWidget);
83 hbox->setStretch(1, 1);
82 // hbox->setStretch(1, 1);
84
83
85 setLayout(hbox);
84 setLayout(hbox);
86
85
87 m_autoScaleCheck->setChecked(true);
86 m_autoScaleCheck->setChecked(true);
88 chartTypeChanged(4);
87 chartTypeChanged(4);
89 testDataChanged(0);
88 testDataChanged(0);
90 }
89 }
91
90
92 void MainWidget::addSeries()
91 void MainWidget::addSeries()
93 {
92 {
94 DataSerieDialog dialog(m_defaultSeries, this);
93 DataSerieDialog dialog(m_defaultSeries, this);
95 connect(&dialog, SIGNAL(accepted(QString, QString)), this, SLOT(addSeries(QString, QString)));
94 connect(&dialog, SIGNAL(accepted(QString, QString)), this, SLOT(addSeries(QString, QString)));
96 dialog.exec();
95 dialog.exec();
97 }
96 }
98
97
99 void MainWidget::addSeries(QString series, QString data)
98 void MainWidget::addSeries(QString series, QString data)
100 {
99 {
101 qDebug() << "addSeries: " << series << " data: " << data;
100 qDebug() << "addSeries: " << series << " data: " << data;
102 m_defaultSeries = series;
101 m_defaultSeries = series;
103
102
103 QXYChartSeries* series0 = 0;
104
104 // TODO: color of the series
105 // TODO: color of the series
105 QXYChartSeries* series0 = QXYChartSeries::create();
106 if (series == "Scatter") {
107 series0 = QXYChartSeries::create();
108 } else if (series == "Line") {
109 series0 = QXYChartSeries::create();
110 } else {
111 // TODO
112 series0 = QXYChartSeries::create();
113 }
106
114
107 if (data == "linear") {
115 if (data == "linear") {
108 for (int i = 0; i < 10; i++)
116 for (int i = 0; i < 10; i++)
109 series0->add(i, 10);
117 series0->add(i, 10);
110 } else if (data == "linear, 1M") {
118 } else if (data == "linear, 1M") {
111 for (int i = 0; i < 1000000; i++)
119 for (int i = 0; i < 1000000; i++)
112 series0->add(i, 20);
120 series0->add(i, 20);
113 } else if (data == "SIN") {
121 } else if (data == "SIN") {
114 for (int x = 0; x < 100; x++)
122 for (int x = 0; x < 100; x++)
115 series0->add(x, abs(sin(3.14159265358979 / 50 * x) * 100));
123 series0->add(x, abs(sin(3.14159265358979 / 50 * x) * 100));
116 QList<QXYChartSeries*> dataset;
124 QList<QXYChartSeries*> dataset;
117 dataset << series0;
125 dataset << series0;
118 } else if (data == "SIN + random") {
126 } else if (data == "SIN + random") {
119 for (qreal x = 0; x < 100; x += 0.1) {
127 for (qreal x = 0; x < 100; x += 0.1) {
120 series0->add(x + (rand() % 5),
128 series0->add(x + (rand() % 5),
121 abs(sin(3.14159265358979 / 50 * x) * 100) + (rand() % 5));
129 abs(sin(3.14159265358979 / 50 * x) * 100) + (rand() % 5));
122 }
130 }
123 } else {
131 } else {
124 // TODO: check if data has a valid file name
132 // TODO: check if data has a valid file name
125 }
133 }
126
134
127 if (series == "Scatter") {
135 m_chartWidget->addSeries(series0);
128 m_chartWidget->addSeries(series0);
129 } else if (series == "Line") {
130 m_chartWidget->addSeries(series0);
131 } else {
132 // TODO
133 }
134 }
136 }
135
137
136 void MainWidget::chartTypeChanged(int itemIndex)
138 void MainWidget::chartTypeChanged(int itemIndex)
137 {
139 {
138 // TODO: change chart type
140 // TODO: change chart type
139 switch (itemIndex) {
141 switch (itemIndex) {
140 case 4:
142 case 4:
141 //m_chartWidget->setType(4);
143 //m_chartWidget->setType(4);
142 break;
144 break;
143 default: {
145 default: {
144 //m_chartWidget->setType(0);
146 //m_chartWidget->setType(0);
145 break;
147 break;
146 }
148 }
147 }
149 }
148 }
150 }
149
151
150 void MainWidget::testDataChanged(int itemIndex)
152 void MainWidget::testDataChanged(int itemIndex)
151 {
153 {
152 qDebug() << "testDataChanged: " << itemIndex;
154 qDebug() << "testDataChanged: " << itemIndex;
153
155
154 // switch (itemIndex) {
156 // switch (itemIndex) {
155 // case 0: {
157 // case 0: {
156 // QList<QChartDataPoint> data;
158 // QList<QChartDataPoint> data;
157 // for (int x = 0; x < 20; x++) {
159 // for (int x = 0; x < 20; x++) {
158 // data.append(QChartDataPoint() << x << x / 2);
160 // data.append(QChartDataPoint() << x << x / 2);
159 // }
161 // }
160 // m_chartWidget->setData(data);
162 // m_chartWidget->setData(data);
161 // break;
163 // break;
162 // }
164 // }
163 // case 1: {
165 // case 1: {
164 // QList<QChartDataPoint> data;
166 // QList<QChartDataPoint> data;
165 // for (int x = 0; x < 100; x++) {
167 // for (int x = 0; x < 100; x++) {
166 // data.append(QChartDataPoint() << x - 200 << 2 * (uint(sin(3.14159/50*x)*80) % 100));
168 // data.append(QChartDataPoint() << x - 200 << 2 * (uint(sin(3.14159/50*x)*80) % 100));
167 // }
169 // }
168 // m_chartWidget->setData(data);
170 // m_chartWidget->setData(data);
169 // break;
171 // break;
170 // }
172 // }
171 // case 2: {
173 // case 2: {
172 // QList<QChartDataPoint> data;
174 // QList<QChartDataPoint> data;
173 // for (int x = 0; x < 1000; x++) {
175 // for (int x = 0; x < 1000; x++) {
174 // data.append(QChartDataPoint() << x - 200 << 2 * (uint(sin(3.14159/50*x)*80) % 100) + (rand() % 100 * 0.2));
176 // data.append(QChartDataPoint() << x - 200 << 2 * (uint(sin(3.14159/50*x)*80) % 100) + (rand() % 100 * 0.2));
175 // data.append(QChartDataPoint() << x - 200 << 2 * (uint(sin(3.14159/50*x)*80) % 100) + (rand() % 100 * 0.2));
177 // data.append(QChartDataPoint() << x - 200 << 2 * (uint(sin(3.14159/50*x)*80) % 100) + (rand() % 100 * 0.2));
176 // data.append(QChartDataPoint() << x - 200 << 2 * (uint(sin(3.14159/50*x)*80) % 100) + (rand() % 100 * 0.2));
178 // data.append(QChartDataPoint() << x - 200 << 2 * (uint(sin(3.14159/50*x)*80) % 100) + (rand() % 100 * 0.2));
177 // }
179 // }
178 // m_chartWidget->setData(data);
180 // m_chartWidget->setData(data);
179 // break;
181 // break;
180 // }
182 // }
181 // default:
183 // default:
182 // break;
184 // break;
183 // }
185 // }
184 }
186 }
185
187
186 void MainWidget::backgroundChanged(int itemIndex)
188 void MainWidget::backgroundChanged(int itemIndex)
187 {
189 {
188 qDebug() << "backgroundChanged: " << itemIndex;
190 qDebug() << "backgroundChanged: " << itemIndex;
189 }
191 }
190
192
191 void MainWidget::autoScaleChanged(int value)
193 void MainWidget::autoScaleChanged(int value)
192 {
194 {
193 if (value) {
195 if (value) {
194 // TODO: enable auto scaling
196 // TODO: enable auto scaling
195 } else {
197 } else {
196 // TODO: set scaling manually (and disable auto scaling)
198 // TODO: set scaling manually (and disable auto scaling)
197 }
199 }
198
200
199 m_xMinSpin->setEnabled(!value);
201 m_xMinSpin->setEnabled(!value);
200 m_xMaxSpin->setEnabled(!value);
202 m_xMaxSpin->setEnabled(!value);
201 m_yMinSpin->setEnabled(!value);
203 m_yMinSpin->setEnabled(!value);
202 m_yMaxSpin->setEnabled(!value);
204 m_yMaxSpin->setEnabled(!value);
203 }
205 }
204
206
205 void MainWidget::xMinChanged(int value)
207 void MainWidget::xMinChanged(int value)
206 {
208 {
207 qDebug() << "xMinChanged: " << value;
209 qDebug() << "xMinChanged: " << value;
208 }
210 }
209
211
210 void MainWidget::xMaxChanged(int value)
212 void MainWidget::xMaxChanged(int value)
211 {
213 {
212 qDebug() << "xMaxChanged: " << value;
214 qDebug() << "xMaxChanged: " << value;
213 }
215 }
214
216
215 void MainWidget::yMinChanged(int value)
217 void MainWidget::yMinChanged(int value)
216 {
218 {
217 qDebug() << "yMinChanged: " << value;
219 qDebug() << "yMinChanged: " << value;
218 }
220 }
219
221
220 void MainWidget::yMaxChanged(int value)
222 void MainWidget::yMaxChanged(int value)
221 {
223 {
222 qDebug() << "yMaxChanged: " << value;
224 qDebug() << "yMaxChanged: " << value;
223 }
225 }
@@ -1,43 +1,43
1 #ifndef MAINWIDGET_H
1 #ifndef MAINWIDGET_H
2 #define MAINWIDGET_H
2 #define MAINWIDGET_H
3
3
4 #include <qchartconfig.h>
4 #include <qchartglobal.h>
5 #include <qchartwidget.h>
5 #include <qchartwidget.h>
6 #include <QWidget>
6 #include <QWidget>
7
7
8 class QSpinBox;
8 class QSpinBox;
9 class QCheckBox;
9 class QCheckBox;
10
10
11 QCHART_USE_NAMESPACE
11 QTCOMMERCIALCHART_USE_NAMESPACE
12
12
13 class MainWidget : public QWidget
13 class MainWidget : public QWidget
14 {
14 {
15 Q_OBJECT
15 Q_OBJECT
16 public:
16 public:
17 explicit MainWidget(QWidget *parent = 0);
17 explicit MainWidget(QWidget *parent = 0);
18
18
19 signals:
19 signals:
20
20
21 private slots:
21 private slots:
22 void chartTypeChanged(int itemIndex);
22 void chartTypeChanged(int itemIndex);
23 void addSeries();
23 void addSeries();
24 void addSeries(QString series, QString data);
24 void addSeries(QString series, QString data);
25 void testDataChanged(int itemIndex);
25 void testDataChanged(int itemIndex);
26 void backgroundChanged(int itemIndex);
26 void backgroundChanged(int itemIndex);
27 void autoScaleChanged(int value);
27 void autoScaleChanged(int value);
28 void xMinChanged(int value);
28 void xMinChanged(int value);
29 void xMaxChanged(int value);
29 void xMaxChanged(int value);
30 void yMinChanged(int value);
30 void yMinChanged(int value);
31 void yMaxChanged(int value);
31 void yMaxChanged(int value);
32
32
33 private:
33 private:
34 QChartWidget *m_chartWidget;
34 QChartWidget *m_chartWidget;
35 QCheckBox *m_autoScaleCheck;
35 QCheckBox *m_autoScaleCheck;
36 QSpinBox *m_xMinSpin;
36 QSpinBox *m_xMinSpin;
37 QSpinBox *m_xMaxSpin;
37 QSpinBox *m_xMaxSpin;
38 QSpinBox *m_yMinSpin;
38 QSpinBox *m_yMinSpin;
39 QSpinBox *m_yMaxSpin;
39 QSpinBox *m_yMaxSpin;
40 QString m_defaultSeries;
40 QString m_defaultSeries;
41 };
41 };
42
42
43 #endif // MAINWIDGET_H
43 #endif // MAINWIDGET_H
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now