##// END OF EJS Templates
Fix previous broken commit
Michal Klocek -
r145:251cad7c49ee
parent child
Show More
@@ -1,7 +1,7
1 #include <QApplication>
1 #include <QApplication>
2 #include <QMainWindow>
2 #include <QMainWindow>
3 #include <qchartview.h>
3 #include <qchartview.h>
4 #include <qxychartseries.h>
4 #include <qlinechartseries.h>
5 #include <qchart.h>
5 #include <qchart.h>
6 #include <cmath>
6 #include <cmath>
7
7
@@ -15,11 +15,11 int main(int argc, char *argv[])
15
15
16 QMainWindow window;
16 QMainWindow window;
17
17
18 QXYChartSeries* series0 = QXYChartSeries::create();
18 QLineChartSeries* series0 = QLineChartSeries::create();
19 QPen blue(Qt::blue);
19 QPen blue(Qt::blue);
20 blue.setWidth(3);
20 blue.setWidth(3);
21 series0->setPen(blue);
21 series0->setPen(blue);
22 QXYChartSeries* series1 = QXYChartSeries::create();
22 QLineChartSeries* series1 = QLineChartSeries::create();
23 QPen red(Qt::red);
23 QPen red(Qt::red);
24 red.setWidth(3);
24 red.setWidth(3);
25 series1->setPen(red);
25 series1->setPen(red);
@@ -8,7 +8,7
8
8
9 TARGET = dynamicLineChart
9 TARGET = dynamicLineChart
10 TEMPLATE = app
10 TEMPLATE = app
11 QT += core gui
11 QT += core gui opengl
12 SOURCES += main.cpp
12 SOURCES += main.cpp
13 HEADERS += wavegenerator.h
13 HEADERS += wavegenerator.h
14
14
@@ -1,10 +1,11
1 #include <QApplication>
1 #include <QApplication>
2 #include <QMainWindow>
2 #include <QMainWindow>
3 #include <qchartview.h>
3 #include <qchartview.h>
4 #include <qxychartseries.h>
4 #include <qlinechartseries.h>
5 #include <qchart.h>
5 #include <qchart.h>
6 #include <cmath>
6 #include <cmath>
7 #include "wavegenerator.h"
7 #include "wavegenerator.h"
8 #include <QGLWidget>
8
9
9 int main(int argc, char *argv[])
10 int main(int argc, char *argv[])
10 {
11 {
@@ -12,11 +13,11 int main(int argc, char *argv[])
12
13
13 QMainWindow window;
14 QMainWindow window;
14
15
15 QXYChartSeries* series0 = QXYChartSeries::create();
16 QLineChartSeries* series0 = QLineChartSeries::create();
16 QPen blue(Qt::blue);
17 QPen blue(Qt::blue);
17 blue.setWidth(3);
18 blue.setWidth(3);
18 series0->setPen(blue);
19 series0->setPen(blue);
19 QXYChartSeries* series1 = QXYChartSeries::create();
20 QLineChartSeries* series1 = QLineChartSeries::create();
20 QPen red(Qt::red);
21 QPen red(Qt::red);
21 red.setWidth(3);
22 red.setWidth(3);
22 series1->setPen(red);
23 series1->setPen(red);
@@ -25,6 +26,7 int main(int argc, char *argv[])
25
26
26 QChartView* chartView = new QChartView(&window);
27 QChartView* chartView = new QChartView(&window);
27
28
29 chartView->setViewport( new QGLWidget() );
28 chartView->setRenderHint(QPainter::Antialiasing);
30 chartView->setRenderHint(QPainter::Antialiasing);
29 chartView->setTitle("This is wave generator buahha.");
31 chartView->setTitle("This is wave generator buahha.");
30 chartView->addSeries(series0);
32 chartView->addSeries(series0);
@@ -2,7 +2,7
2 #include <QTime>
2 #include <QTime>
3 #include <QObject>
3 #include <QObject>
4 #include <cmath>
4 #include <cmath>
5 #include <qxychartseries.h>
5 #include <qlinechartseries.h>
6
6
7 QTCOMMERCIALCHART_USE_NAMESPACE
7 QTCOMMERCIALCHART_USE_NAMESPACE
8
8
@@ -14,7 +14,7 class WaveGenerator: public QObject
14 Q_OBJECT
14 Q_OBJECT
15
15
16 public:
16 public:
17 WaveGenerator(QXYChartSeries* series1, QXYChartSeries* series2) :
17 WaveGenerator(QLineChartSeries* series1, QLineChartSeries* series2) :
18 m_series1(series1),
18 m_series1(series1),
19 m_series2(series2),
19 m_series2(series2),
20 m_wave(0),
20 m_wave(0),
@@ -52,8 +52,8 public slots:
52 }
52 }
53
53
54 private:
54 private:
55 QXYChartSeries* m_series1;
55 QLineChartSeries* m_series1;
56 QXYChartSeries* m_series2;
56 QLineChartSeries* m_series2;
57 int m_wave;
57 int m_wave;
58 qreal m_step;
58 qreal m_step;
59 QTimer m_timer;
59 QTimer m_timer;
@@ -1,7 +1,7
1 #include <QApplication>
1 #include <QApplication>
2 #include <QMainWindow>
2 #include <QMainWindow>
3 #include <qchartview.h>
3 #include <qchartview.h>
4 #include <qxychartseries.h>
4 #include <qlinechartseries.h>
5 #include <qchart.h>
5 #include <qchart.h>
6 #include <cmath>
6 #include <cmath>
7
7
@@ -15,11 +15,11 int main(int argc, char *argv[])
15
15
16 QMainWindow window;
16 QMainWindow window;
17
17
18 QXYChartSeries* series0 = QXYChartSeries::create();
18 QLineChartSeries* series0 = QLineChartSeries::create();
19 QPen blue(Qt::blue);
19 QPen blue(Qt::blue);
20 blue.setWidth(3);
20 blue.setWidth(3);
21 series0->setPen(blue);
21 series0->setPen(blue);
22 QXYChartSeries* series1 = QXYChartSeries::create();
22 QLineChartSeries* series1 = QLineChartSeries::create();
23 QPen red(Qt::red);
23 QPen red(Qt::red);
24 red.setWidth(3);
24 red.setWidth(3);
25 series1->setPen(red);
25 series1->setPen(red);
@@ -1,7 +1,7
1 #include "chartwidget.h"
1 #include "chartwidget.h"
2 #include <QApplication>
2 #include <QApplication>
3 #include <QMainWindow>
3 #include <QMainWindow>
4 #include <qxychartseries.h>
4 #include <qlinechartseries.h>
5 #include <cmath>
5 #include <cmath>
6
6
7 QTCOMMERCIALCHART_USE_NAMESPACE
7 QTCOMMERCIALCHART_USE_NAMESPACE
@@ -14,11 +14,11 int main(int argc, char *argv[])
14
14
15 QMainWindow window;
15 QMainWindow window;
16
16
17 QXYChartSeries* series0 = QXYChartSeries::create();
17 QLineChartSeries* series0 = QLineChartSeries::create();
18 QPen blue(Qt::blue);
18 QPen blue(Qt::blue);
19 blue.setWidth(3);
19 blue.setWidth(3);
20 series0->setPen(blue);
20 series0->setPen(blue);
21 QXYChartSeries* series1 = QXYChartSeries::create();
21 QLineChartSeries* series1 = QLineChartSeries::create();
22 QPen red(Qt::red);
22 QPen red(Qt::red);
23 red.setWidth(3);
23 red.setWidth(3);
24 series1->setPen(red);
24 series1->setPen(red);
@@ -1,6 +1,6
1 #include "declarativeseries.h"
1 #include "declarativeseries.h"
2 #include "declarativechart.h"
2 #include "declarativechart.h"
3 #include <qxychartseries.h>
3 #include <qlinechartseries.h>
4 #include <cmath>
4 #include <cmath>
5 #include <QDebug>
5 #include <QDebug>
6
6
@@ -44,9 +44,9 void DeclarativeSeries::initSeries()
44
44
45 switch (m_seriesType) {
45 switch (m_seriesType) {
46 case SeriesTypeLine: {
46 case SeriesTypeLine: {
47 m_series = QXYChartSeries::create(this);
47 m_series = QLineChartSeries::create(this);
48 for (qreal i(0.0); i < 100.0; i += 1.0)
48 for (qreal i(0.0); i < 100.0; i += 1.0)
49 ((QXYChartSeries *)m_series)->add(i, i);
49 ((QLineChartSeries *)m_series)->add(i, i);
50 chart->addSeries(m_series);
50 chart->addSeries(m_series);
51 break;
51 break;
52 }
52 }
@@ -13,27 +13,14 AxisItem::AxisItem(QChartAxis* axis,AxisType type,QGraphicsItem* parent) :
13 m_ticks(4),
13 m_ticks(4),
14 m_type(type)
14 m_type(type)
15 {
15 {
16 //initial initialization
17 handleAxisChanged();
16 }
18 }
17
19
18 AxisItem::~AxisItem()
20 AxisItem::~AxisItem()
19 {
21 {
20 }
22 }
21
23
22 void AxisItem::setLength(int length)
23 {
24 QPainterPath path;
25 path.moveTo(QPointF(0,0));
26 path.lineTo(length,0);
27 // path.lineTo(length-4,0);
28 // path.lineTo(length,3);
29 // path.lineTo(length-4,6);
30 // path.lineTo(length-4,4);
31 // path.lineTo(0,4);
32 // path.lineTo(0,2);
33 m_path=path;
34 update();
35 }
36
37 QRectF AxisItem::boundingRect() const
24 QRectF AxisItem::boundingRect() const
38 {
25 {
39 return m_rect;
26 return m_rect;
@@ -97,8 +84,10 void AxisItem::createItems()
97
84
98 if(!m_rect.isValid()) return;
85 if(!m_rect.isValid()) return;
99
86
100 if(m_type==X_AXIS) {
87 switch (m_type)
101
88 {
89 case X_AXIS:
90 {
102 const qreal deltaX = m_rect.width() / m_ticks;
91 const qreal deltaX = m_rect.width() / m_ticks;
103
92
104 for (int i = 0; i <= m_ticks; ++i) {
93 for (int i = 0; i <= m_ticks; ++i) {
@@ -116,9 +105,10 void AxisItem::createItems()
116 m_labels<<text;
105 m_labels<<text;
117 }
106 }
118 }
107 }
108 break;
119
109
120 if(m_type==Y_AXIS) {
110 case Y_AXIS:
121
111 {
122 const qreal deltaY = m_rect.height()/ m_ticks;
112 const qreal deltaY = m_rect.height()/ m_ticks;
123
113
124 for (int j = 0; j <= m_ticks; ++j) {
114 for (int j = 0; j <= m_ticks; ++j) {
@@ -131,15 +121,17 void AxisItem::createItems()
131 m_grid<<new QGraphicsLineItem(m_rect.left() , y, m_rect.right(), y,this);
121 m_grid<<new QGraphicsLineItem(m_rect.left() , y, m_rect.right(), y,this);
132 QGraphicsSimpleTextItem* text = new QGraphicsSimpleTextItem(QString::number(label),this);
122 QGraphicsSimpleTextItem* text = new QGraphicsSimpleTextItem(QString::number(label),this);
133 QPointF center = text->boundingRect().center();
123 QPointF center = text->boundingRect().center();
134
135 text->setPos(m_rect.left() - text->boundingRect().width() - LABEL_PADDING , y-center.y());
124 text->setPos(m_rect.left() - text->boundingRect().width() - LABEL_PADDING , y-center.y());
136 //text->rotate(-45);
125
137 m_labels<<text;
126 m_labels<<text;
138
127
139 }
128 }
140 }
129 }
141
130 break;
142 //painter->drawRect(m_rect.adjusted(0, 0, -1, -1));
131 default:
132 qDebug()<<"Unknown axis type";
133 break;
134 }
143 }
135 }
144
136
145 void AxisItem::clear()
137 void AxisItem::clear()
@@ -34,8 +34,6 private:
34 void clear();
34 void clear();
35
35
36 public:
36 public:
37 void setLength(int length);
38 void setWidth(int width);
39 AxisType axisType() const {return m_type;};
37 AxisType axisType() const {return m_type;};
40
38
41 protected:
39 protected:
@@ -49,9 +47,6 private:
49 AxisType m_type;
47 AxisType m_type;
50 int m_ticks;
48 int m_ticks;
51 Domain m_domain;
49 Domain m_domain;
52
53
54
55 QRectF m_rect;
50 QRectF m_rect;
56
51
57 QPainterPath m_path;
52 QPainterPath m_path;
@@ -1,6 +1,6
1 #include "chartdataset_p.h"
1 #include "chartdataset_p.h"
2 //series
2 //series
3 #include "qxychartseries.h"
3 #include "qlinechartseries.h"
4 #include "barchartseries.h"
4 #include "barchartseries.h"
5 #include "stackedbarchartseries.h"
5 #include "stackedbarchartseries.h"
6 #include "percentbarchartseries.h"
6 #include "percentbarchartseries.h"
@@ -38,7 +38,7 void ChartDataSet::addSeries(QChartSeries* series)
38 {
38 {
39 case QChartSeries::SeriesTypeLine: {
39 case QChartSeries::SeriesTypeLine: {
40
40
41 QXYChartSeries* xyseries = static_cast<QXYChartSeries*>(series);
41 QLineChartSeries* xyseries = static_cast<QLineChartSeries*>(series);
42
42
43 for (int i = 0; i < xyseries->count(); i++)
43 for (int i = 0; i < xyseries->count(); i++)
44 {
44 {
@@ -7,20 +7,17
7 #include "barchartseries.h"
7 #include "barchartseries.h"
8 #include "stackedbarchartseries.h"
8 #include "stackedbarchartseries.h"
9 #include "percentbarchartseries.h"
9 #include "percentbarchartseries.h"
10 #include "qxychartseries.h"
10 #include "qlinechartseries.h"
11 #include "qpieseries.h"
11 #include "qpieseries.h"
12 //items
12 //items
13 #include "axisitem_p.h"
13 #include "axisitem_p.h"
14 #include "bargroup.h"
14 #include "bargroup.h"
15 #include "stackedbargroup.h"
15 #include "stackedbargroup.h"
16 #include "xylinechartitem_p.h"
16 #include "linechartitem_p.h"
17 #include "percentbargroup.h"
17 #include "percentbargroup.h"
18 #include "linechartanimationitem_p.h"
18 #include "linechartanimationitem_p.h"
19 #include "piepresentation.h"
19 #include "piepresentation.h"
20
20
21 #include <QAbstractAnimation>
22 #include <QPropertyAnimation>
23
24 QTCOMMERCIALCHART_BEGIN_NAMESPACE
21 QTCOMMERCIALCHART_BEGIN_NAMESPACE
25
22
26 ChartPresenter::ChartPresenter(QChart* chart,ChartDataSet* dataset):QObject(chart),
23 ChartPresenter::ChartPresenter(QChart* chart,ChartDataSet* dataset):QObject(chart),
@@ -83,8 +80,8 void ChartPresenter::handleSeriesAdded(QChartSeries* series)
83 switch(series->type())
80 switch(series->type())
84 {
81 {
85 case QChartSeries::SeriesTypeLine: {
82 case QChartSeries::SeriesTypeLine: {
86 QXYChartSeries* lineSeries = static_cast<QXYChartSeries*>(series);
83 QLineChartSeries* lineSeries = static_cast<QLineChartSeries*>(series);
87 XYLineChartItem* item = new LineChartAnimationItem(this,lineSeries,m_chart);
84 LineChartItem* item = new LineChartAnimationItem(this,lineSeries,m_chart);
88 m_chartTheme->decorate(item,lineSeries,m_chartItems.count());
85 m_chartTheme->decorate(item,lineSeries,m_chartItems.count());
89 QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),item,SLOT(handleGeometryChanged(const QRectF&)));
86 QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),item,SLOT(handleGeometryChanged(const QRectF&)));
90 QObject::connect(m_dataset,SIGNAL(domainChanged(const Domain&)),item,SLOT(handleDomainChanged(const Domain&)));
87 QObject::connect(m_dataset,SIGNAL(domainChanged(const Domain&)),item,SLOT(handleDomainChanged(const Domain&)));
@@ -6,12 +6,12
6 #include "barchartseries.h"
6 #include "barchartseries.h"
7 #include "stackedbarchartseries.h"
7 #include "stackedbarchartseries.h"
8 #include "percentbarchartseries.h"
8 #include "percentbarchartseries.h"
9 #include "qxychartseries.h"
9 #include "qlinechartseries.h"
10 //items
10 //items
11 #include "axisitem_p.h"
11 #include "axisitem_p.h"
12 #include "bargroup.h"
12 #include "bargroup.h"
13 #include "stackedbargroup.h"
13 #include "stackedbargroup.h"
14 #include "xylinechartitem_p.h"
14 #include "linechartitem_p.h"
15 #include "percentbargroup.h"
15 #include "percentbargroup.h"
16
16
17 //themes
17 //themes
@@ -74,8 +74,8 void ChartTheme::decorate(ChartItem* item, QChartSeries* series,int count)
74 switch(series->type())
74 switch(series->type())
75 {
75 {
76 case QChartSeries::SeriesTypeLine: {
76 case QChartSeries::SeriesTypeLine: {
77 QXYChartSeries* s = static_cast<QXYChartSeries*>(series);
77 QLineChartSeries* s = static_cast<QLineChartSeries*>(series);
78 XYLineChartItem* i = static_cast<XYLineChartItem*>(item);
78 LineChartItem* i = static_cast<LineChartItem*>(item);
79 decorate(i,s,count);
79 decorate(i,s,count);
80 break;
80 break;
81 }
81 }
@@ -104,7 +104,7 void ChartTheme::decorate(ChartItem* item, QChartSeries* series,int count)
104
104
105 }
105 }
106
106
107 void ChartTheme::decorate(XYLineChartItem* item, QXYChartSeries* series,int count)
107 void ChartTheme::decorate(LineChartItem* item, QLineChartSeries* series,int count)
108 {
108 {
109 item->setPen(series->pen());
109 item->setPen(series->pen());
110 }
110 }
@@ -9,8 +9,8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
9
9
10 class ChartItem;
10 class ChartItem;
11 class QChartSeries;
11 class QChartSeries;
12 class XYLineChartItem;
12 class LineChartItem;
13 class QXYChartSeries;
13 class QLineChartSeries;
14 class BarGroup;
14 class BarGroup;
15 class BarChartSeries;
15 class BarChartSeries;
16 class StackedBarGroup;
16 class StackedBarGroup;
@@ -26,7 +26,7 public:
26 static ChartTheme* createTheme(QChart::ChartThemeId theme);
26 static ChartTheme* createTheme(QChart::ChartThemeId theme);
27 void decorate(QChart* chart);
27 void decorate(QChart* chart);
28 void decorate(ChartItem* item, QChartSeries* series,int count);
28 void decorate(ChartItem* item, QChartSeries* series,int count);
29 void decorate(XYLineChartItem* item, QXYChartSeries*, int count);
29 void decorate(LineChartItem* item, QLineChartSeries*, int count);
30 void decorate(BarGroup* item, BarChartSeries* series,int count);
30 void decorate(BarGroup* item, BarChartSeries* series,int count);
31 void decorate(StackedBarGroup* item, StackedBarChartSeries* series,int count);
31 void decorate(StackedBarGroup* item, StackedBarChartSeries* series,int count);
32 void decorate(PercentBarGroup* item, PercentBarChartSeries* series,int count);
32 void decorate(PercentBarGroup* item, PercentBarChartSeries* series,int count);
@@ -1,5 +1,5
1 #include "linechartanimationitem_p.h"
1 #include "linechartanimationitem_p.h"
2 #include "xylinechartitem_p.h"
2 #include "linechartitem_p.h"
3 #include <QPropertyAnimation>
3 #include <QPropertyAnimation>
4
4
5 QTCOMMERCIALCHART_BEGIN_NAMESPACE
5 QTCOMMERCIALCHART_BEGIN_NAMESPACE
@@ -7,8 +7,8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
7 const static int duration = 500;
7 const static int duration = 500;
8
8
9
9
10 LineChartAnimationItem::LineChartAnimationItem(ChartPresenter* presenter, QXYChartSeries* series,QGraphicsItem *parent):
10 LineChartAnimationItem::LineChartAnimationItem(ChartPresenter* presenter, QLineChartSeries* series,QGraphicsItem *parent):
11 XYLineChartItem(presenter,series,parent)
11 LineChartItem(presenter,series,parent)
12 {
12 {
13
13
14 }
14 }
@@ -44,7 +44,7 void LineChartAnimationItem::aw_addPoints(int points)
44 {
44 {
45 int index = count();
45 int index = count();
46 for(int i = index;i< points ;i++){
46 for(int i = index;i< points ;i++){
47 XYLineChartItem::addPoint(m_data.at(i));
47 LineChartItem::addPoint(m_data.at(i));
48 }
48 }
49 updateGeometry();
49 updateGeometry();
50 update();
50 update();
@@ -52,7 +52,7 void LineChartAnimationItem::aw_addPoints(int points)
52
52
53 void LineChartAnimationItem::aw_setPoint(int index,const QPointF& point)
53 void LineChartAnimationItem::aw_setPoint(int index,const QPointF& point)
54 {
54 {
55 XYLineChartItem::setPoint(index,point);
55 LineChartItem::setPoint(index,point);
56 updateGeometry();
56 updateGeometry();
57 update();
57 update();
58 }
58 }
@@ -1,20 +1,20
1 #ifndef XYLINEPRESENTER_P_H_
1 #ifndef LINECHARTANIMATIONITEM_P_H_
2 #define XYLINEPRESENTER_P_H_
2 #define LINECHARTANIMATIONITEM_P_H_
3
3
4 #include "qchartglobal.h"
4 #include "qchartglobal.h"
5 #include "xylinechartitem_p.h"
5 #include "linechartitem_p.h"
6 #include "domain_p.h"
6 #include "domain_p.h"
7
7
8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
9
9
10 class XYLineChartItem;
10 class LineChartItem;
11
11
12 class LineChartAnimationItem : public XYLineChartItem {
12 class LineChartAnimationItem : public LineChartItem {
13 Q_OBJECT
13 Q_OBJECT
14 Q_PROPERTY(int a_addPoints READ ar_addPoints WRITE aw_addPoints);
14 Q_PROPERTY(int a_addPoints READ ar_addPoints WRITE aw_addPoints);
15 // Q_PROPERTY(QPointF a_setPoint READ ar_setPoint WRITE aw_setPoint);
15 // Q_PROPERTY(QPointF a_setPoint READ ar_setPoint WRITE aw_setPoint);
16 public:
16 public:
17 LineChartAnimationItem(ChartPresenter* presenter, QXYChartSeries *series, QGraphicsItem *parent = 0);
17 LineChartAnimationItem(ChartPresenter* presenter, QLineChartSeries *series, QGraphicsItem *parent = 0);
18 virtual ~LineChartAnimationItem();
18 virtual ~LineChartAnimationItem();
19
19
20 void addPoints(const QVector<QPointF>& points);
20 void addPoints(const QVector<QPointF>& points);
@@ -52,4 +52,4 public:
52
52
53 QTCOMMERCIALCHART_END_NAMESPACE
53 QTCOMMERCIALCHART_END_NAMESPACE
54
54
55 #endif /* XYLINEPRESENTER_P_H_ */
55 #endif
@@ -15,7 +15,7
15 #include "barchartseries.h"
15 #include "barchartseries.h"
16 #include "stackedbarchartseries.h"
16 #include "stackedbarchartseries.h"
17 #include "percentbarchartseries.h"
17 #include "percentbarchartseries.h"
18 #include "qxychartseries.h"
18 #include "qlinechartseries.h"
19
19
20 #include <QGraphicsScene>
20 #include <QGraphicsScene>
21 #include <QGraphicsSceneResizeEvent>
21 #include <QGraphicsSceneResizeEvent>
@@ -47,7 +47,7 QChartSeries* QChart::createSeries(QChartSeries::QChartSeriesType type)
47
47
48 switch (type) {
48 switch (type) {
49 case QChartSeries::SeriesTypeLine: {
49 case QChartSeries::SeriesTypeLine: {
50 series = QXYChartSeries::create();
50 series = QLineChartSeries::create();
51 break;
51 break;
52 }
52 }
53 case QChartSeries::SeriesTypeBar: {
53 case QChartSeries::SeriesTypeBar: {
@@ -2,7 +2,7
2 #include "qchartseries.h"
2 #include "qchartseries.h"
3
3
4 #include "barchartseries.h"
4 #include "barchartseries.h"
5 #include "qxychartseries.h"
5 #include "qlinechartseries.h"
6
6
7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
8
8
@@ -12,7 +12,7 QChartSeries* QChartSeries::create(QChartSeriesType type, QObject* parent)
12 // TODO: Other types
12 // TODO: Other types
13 switch (type) {
13 switch (type) {
14 case QChartSeries::SeriesTypeLine: {
14 case QChartSeries::SeriesTypeLine: {
15 QXYChartSeries* s = QXYChartSeries::create(parent); // TODO: do we need create method for derived implementations?
15 QLineChartSeries* s = QLineChartSeries::create(parent); // TODO: do we need create method for derived implementations?
16 return s;
16 return s;
17 }
17 }
18 case QChartSeries::SeriesTypePie: {
18 case QChartSeries::SeriesTypePie: {
@@ -1,18 +1,12
1 !include( ../common.pri ) {
1 !include( ../common.pri ):error( Couldn't find the common.pri file! )
2 error( Couldn't find the common.pri file! )
3 }
4
5 TARGET = QtCommercialChart
2 TARGET = QtCommercialChart
6 DESTDIR = $$CHART_BUILD_LIB_DIR
3 DESTDIR = $$CHART_BUILD_LIB_DIR
7 TEMPLATE = lib
4 TEMPLATE = lib
8 QT += core \
5 QT += core \
9 gui
6 gui
10
11 CONFIG += debug_and_release
7 CONFIG += debug_and_release
12 CONFIG(debug, debug|release):TARGET = QtCommercialChartd
8 CONFIG(debug, debug|release):TARGET = QtCommercialChartd
13
9 SOURCES += barchart/barchartseries.cpp \
14 SOURCES += \
15 barchart/barchartseries.cpp \
16 barchart/bargroup.cpp \
10 barchart/bargroup.cpp \
17 barchart/bar.cpp \
11 barchart/bar.cpp \
18 barchart/stackedbarchartseries.cpp \
12 barchart/stackedbarchartseries.cpp \
@@ -20,12 +14,15 SOURCES += \
20 barchart/percentbarchartseries.cpp \
14 barchart/percentbarchartseries.cpp \
21 barchart/percentbargroup.cpp \
15 barchart/percentbargroup.cpp \
22 barchart/barlabel.cpp \
16 barchart/barlabel.cpp \
23 xylinechart/qxychartseries.cpp \
17 linechart/linechartanimationitem.cpp \
24 xylinechart/xylinechartitem.cpp \
18 linechart/linechartitem.cpp \
25 xylinechart/linechartanimationitem.cpp \
19 linechart/qlinechartseries.cpp \
26 piechart/qpieseries.cpp \
20 piechart/qpieseries.cpp \
27 piechart/pieslice.cpp \
21 piechart/pieslice.cpp \
28 piechart/piepresentation.cpp \
22 piechart/piepresentation.cpp \
23 barchart/separator.cpp \
24 barchart/bargroupbase.cpp \
25 barchart/barchartseriesbase.cpp \
29 plotdomain.cpp \
26 plotdomain.cpp \
30 qscatterseries.cpp \
27 qscatterseries.cpp \
31 qchart.cpp \
28 qchart.cpp \
@@ -34,18 +31,11 SOURCES += \
34 qchartseries.cpp \
31 qchartseries.cpp \
35 qchartaxis.cpp \
32 qchartaxis.cpp \
36 charttheme.cpp \
33 charttheme.cpp \
37 barchart/separator.cpp \
38 barchart/bargroupbase.cpp \
39 barchart/barchartseriesbase.cpp \
40 chartdataset.cpp \
34 chartdataset.cpp \
41 chartpresenter.cpp \
35 chartpresenter.cpp \
42 domain.cpp
36 domain.cpp
43
37 PRIVATE_HEADERS += linechart/linechartitem_p.h \
44
38 linechart/linechartanimationitem_p.h \
45
46 PRIVATE_HEADERS += \
47 xylinechart/xylinechartitem_p.h \
48 xylinechart/linechartanimationitem_p.h \
49 barchart/barlabel_p.h \
39 barchart/barlabel_p.h \
50 barchart/bar_p.h \
40 barchart/bar_p.h \
51 barchart/separator_p.h \
41 barchart/separator_p.h \
@@ -59,13 +49,7 PRIVATE_HEADERS += \
59 chartdataset_p.h \
49 chartdataset_p.h \
60 chartpresenter_p.h \
50 chartpresenter_p.h \
61 domain_p.h
51 domain_p.h
62
52 PUBLIC_HEADERS += linechart/qlinechartseries.h \
63 PUBLIC_HEADERS += \
64 qchartseries.h \
65 qscatterseries.h \
66 qchart.h \
67 qchartglobal.h \
68 xylinechart/qxychartseries.h \
69 barchart/barchartseries.h \
53 barchart/barchartseries.h \
70 barchart/bargroup.h \
54 barchart/bargroup.h \
71 barchart/stackedbarchartseries.h \
55 barchart/stackedbarchartseries.h \
@@ -75,67 +59,56 PUBLIC_HEADERS += \
75 barchart/barchartseriesbase.h \
59 barchart/barchartseriesbase.h \
76 barchart/bargroupbase.h \
60 barchart/bargroupbase.h \
77 piechart/qpieseries.h \
61 piechart/qpieseries.h \
62 qchartseries.h \
63 qscatterseries.h \
64 qchart.h \
65 qchartglobal.h \
78 qchartview.h \
66 qchartview.h \
79 qchartaxis.h
67 qchartaxis.h
80
68 THEMES += themes/chartthemeicy_p.h \
81 THEMES += \
82 themes/chartthemeicy_p.h \
83 themes/chartthemegrayscale_p.h \
69 themes/chartthemegrayscale_p.h \
84 themes/chartthemescientific_p.h \
70 themes/chartthemescientific_p.h \
85 themes/chartthemevanilla_p.h \
71 themes/chartthemevanilla_p.h
86
87
88 HEADERS += $$PUBLIC_HEADERS
72 HEADERS += $$PUBLIC_HEADERS
89 HEADERS += $$PRIVATE_HEADERS
73 HEADERS += $$PRIVATE_HEADERS
90 HEADERS += $$THEMES
74 HEADERS += $$THEMES
91
75 INCLUDEPATH += linechart \
92 INCLUDEPATH += xylinechart \
93 barchart \
76 barchart \
94 piechart \
77 piechart \
95 themes \
78 themes \
96 .
79 .
97
98 OBJECTS_DIR = $$CHART_BUILD_DIR/lib
80 OBJECTS_DIR = $$CHART_BUILD_DIR/lib
99 MOC_DIR = $$CHART_BUILD_DIR/lib
81 MOC_DIR = $$CHART_BUILD_DIR/lib
100 UI_DIR = $$CHART_BUILD_DIR/lib
82 UI_DIR = $$CHART_BUILD_DIR/lib
101 RCC_DIR = $$CHART_BUILD_DIR/lib
83 RCC_DIR = $$CHART_BUILD_DIR/lib
102
103
104 DEFINES += QTCOMMERCIALCHART_LIBRARY
84 DEFINES += QTCOMMERCIALCHART_LIBRARY
105
106 public_headers.path = $$[QT_INSTALL_HEADERS]/QtCommercialChart
85 public_headers.path = $$[QT_INSTALL_HEADERS]/QtCommercialChart
107 public_headers.files = $$PUBLIC_HEADERS
86 public_headers.files = $$PUBLIC_HEADERS
108 target.path = $$[QT_INSTALL_LIBS]
87 target.path = $$[QT_INSTALL_LIBS]
109 INSTALLS += target \
88 INSTALLS += target \
110 public_headers
89 public_headers
111
112
113 install_build_headers.name = bild_headers
90 install_build_headers.name = bild_headers
114 install_build_headers.output = $$CHART_BUILD_HEADER_DIR/${QMAKE_FILE_BASE}.h
91 install_build_headers.output = $$CHART_BUILD_HEADER_DIR/${QMAKE_FILE_BASE}.h
115 install_build_headers.input = PUBLIC_HEADERS
92 install_build_headers.input = PUBLIC_HEADERS
116 install_build_headers.commands = $$QMAKE_COPY ${QMAKE_FILE_NAME} $$CHART_BUILD_HEADER_DIR
93 install_build_headers.commands = $$QMAKE_COPY \
117 install_build_headers.CONFIG += target_predeps no_link
94 ${QMAKE_FILE_NAME} \
95 $$CHART_BUILD_HEADER_DIR
96 install_build_headers.CONFIG += target_predeps \
97 no_link
118 QMAKE_EXTRA_COMPILERS += install_build_headers
98 QMAKE_EXTRA_COMPILERS += install_build_headers
119
120 chartversion.target = qchartversion_p.h
99 chartversion.target = qchartversion_p.h
121 chartversion.commands = @echo "build_time" > $$chartversion.target;
100 chartversion.commands = @echo \
122 chartversion.depends = $$HEADERS $$SOURCES
101 "build_time" \
102 > \
103 $$chartversion.target;
104 chartversion.depends = $$HEADERS \
105 $$SOURCES
123 PRE_TARGETDEPS += qchartversion_p.h
106 PRE_TARGETDEPS += qchartversion_p.h
124 QMAKE_CLEAN+= qchartversion_p.h
107 QMAKE_CLEAN += qchartversion_p.h
125 QMAKE_EXTRA_TARGETS += chartversion
108 QMAKE_EXTRA_TARGETS += chartversion
126
109 unix:QMAKE_DISTCLEAN += -r \
127 unix:QMAKE_DISTCLEAN += -r $$CHART_BUILD_HEADER_DIR $$CHART_BUILD_LIB_DIR
110 $$CHART_BUILD_HEADER_DIR \
128 win32:QMAKE_DISTCLEAN += /Q $$CHART_BUILD_HEADER_DIR $$CHART_BUILD_LIB_DIR
111 $$CHART_BUILD_LIB_DIR
129
112 win32:QMAKE_DISTCLEAN += /Q \
130
113 $$CHART_BUILD_HEADER_DIR \
131
114 $$CHART_BUILD_LIB_DIR
132
133
134
135
136
137
138
139
140
141
@@ -2,7 +2,7
2 #include "dataseriedialog.h"
2 #include "dataseriedialog.h"
3 #include "qchartseries.h"
3 #include "qchartseries.h"
4 #include "qpieseries.h"
4 #include "qpieseries.h"
5 #include <qxychartseries.h>
5 #include <qlinechartseries.h>
6 #include <barchartseries.h>
6 #include <barchartseries.h>
7 #include <QPushButton>
7 #include <QPushButton>
8 #include <QComboBox>
8 #include <QComboBox>
@@ -223,7 +223,7 void MainWidget::addSeries(QString series, QString data)
223 // lineSeries->add(x.at(i), y.at(i));
223 // lineSeries->add(x.at(i), y.at(i));
224 // }
224 // }
225 //Q_ASSERT(newSeries->setData(x, y));
225 //Q_ASSERT(newSeries->setData(x, y));
226 QXYChartSeries* series0 = QXYChartSeries::create();
226 QLineChartSeries* series0 = QLineChartSeries::create();
227 for (int i(0); i < x.count() && i < y.count(); i++)
227 for (int i(0); i < x.count() && i < y.count(); i++)
228 series0->add(x.at(i), y.at(i));
228 series0->add(x.at(i), y.at(i));
229 m_chartWidget->addSeries(series0);
229 m_chartWidget->addSeries(series0);
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
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