@@ -1,7 +1,7 | |||||
1 | #include <QApplication> |
|
1 | #include <QApplication> | |
2 | #include <QMainWindow> |
|
2 | #include <QMainWindow> | |
3 | #include <QStandardItemModel> |
|
3 | #include <QStandardItemModel> | |
4 | #include <barchartseries.h> |
|
4 | #include <qbarchartseries.h> | |
5 | #include <qbarcategory.h> |
|
5 | #include <qbarcategory.h> | |
6 | #include <qbarset.h> |
|
6 | #include <qbarset.h> | |
7 | #include "chartwidget.h" |
|
7 | #include "chartwidget.h" | |
@@ -16,7 +16,7 int main(int argc, char *argv[]) | |||||
16 | QBarCategory *category = new QBarCategory; |
|
16 | QBarCategory *category = new QBarCategory; | |
17 | *category << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "June" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec"; |
|
17 | *category << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "June" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec"; | |
18 |
|
18 | |||
19 | BarChartSeries* series0 = new BarChartSeries(category); |
|
19 | QBarChartSeries* series0 = new QBarChartSeries(category); | |
20 |
|
20 | |||
21 | QBarSet *set0 = new QBarSet; |
|
21 | QBarSet *set0 = new QBarSet; | |
22 | QBarSet *set1 = new QBarSet; |
|
22 | QBarSet *set1 = new QBarSet; |
@@ -7,7 +7,7 | |||||
7 | #include <qscatterseries.h> |
|
7 | #include <qscatterseries.h> | |
8 | #include <qchartview.h> |
|
8 | #include <qchartview.h> | |
9 | #include <qchartaxis.h> |
|
9 | #include <qchartaxis.h> | |
10 | #include <barchartseries.h> |
|
10 | #include <qbarchartseries.h> | |
11 | #include <qbarcategory.h> |
|
11 | #include <qbarcategory.h> | |
12 | #include <qbarset.h> |
|
12 | #include <qbarset.h> | |
13 | #include <QListWidget> |
|
13 | #include <QListWidget> | |
@@ -91,7 +91,7 void Widget::refreshChart() | |||||
91 | QBarCategory* category = new QBarCategory; |
|
91 | QBarCategory* category = new QBarCategory; | |
92 | for (int i = 0; i < selectedCountriesStrings.size(); i++) |
|
92 | for (int i = 0; i < selectedCountriesStrings.size(); i++) | |
93 | *category << selectedCountriesStrings[i]; |
|
93 | *category << selectedCountriesStrings[i]; | |
94 | BarChartSeries* series0 = new BarChartSeries(category); |
|
94 | QBarChartSeries* series0 = new QBarChartSeries(category); | |
95 |
|
95 | |||
96 | // prepare the selected counries SQL query |
|
96 | // prepare the selected counries SQL query | |
97 | QString countriesQuery = "country IN ("; |
|
97 | QString countriesQuery = "country IN ("; |
@@ -1,7 +1,7 | |||||
1 | #include <QApplication> |
|
1 | #include <QApplication> | |
2 | #include <QMainWindow> |
|
2 | #include <QMainWindow> | |
3 | #include <QStandardItemModel> |
|
3 | #include <QStandardItemModel> | |
4 | #include <percentbarchartseries.h> |
|
4 | #include <qpercentbarchartseries.h> | |
5 | #include "chartwidget.h" |
|
5 | #include "chartwidget.h" | |
6 | #include <qbarcategory.h> |
|
6 | #include <qbarcategory.h> | |
7 | #include <qbarset.h> |
|
7 | #include <qbarset.h> | |
@@ -16,7 +16,7 int main(int argc, char *argv[]) | |||||
16 | QBarCategory *category = new QBarCategory; |
|
16 | QBarCategory *category = new QBarCategory; | |
17 | *category << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "June" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec"; |
|
17 | *category << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "June" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec"; | |
18 |
|
18 | |||
19 | PercentBarChartSeries* series0 = new PercentBarChartSeries(category); |
|
19 | QPercentBarChartSeries* series0 = new QPercentBarChartSeries(category); | |
20 |
|
20 | |||
21 | QBarSet *set0 = new QBarSet; |
|
21 | QBarSet *set0 = new QBarSet; | |
22 | QBarSet *set1 = new QBarSet; |
|
22 | QBarSet *set1 = new QBarSet; |
@@ -1,7 +1,7 | |||||
1 | #include <QApplication> |
|
1 | #include <QApplication> | |
2 | #include <QMainWindow> |
|
2 | #include <QMainWindow> | |
3 | #include <QStandardItemModel> |
|
3 | #include <QStandardItemModel> | |
4 | #include <stackedbarchartseries.h> |
|
4 | #include <qstackedbarchartseries.h> | |
5 | #include "chartwidget.h" |
|
5 | #include "chartwidget.h" | |
6 | #include <qbarset.h> |
|
6 | #include <qbarset.h> | |
7 | #include <qbarcategory.h> |
|
7 | #include <qbarcategory.h> | |
@@ -16,7 +16,7 int main(int argc, char *argv[]) | |||||
16 | QBarCategory *category = new QBarCategory; |
|
16 | QBarCategory *category = new QBarCategory; | |
17 | *category << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "June" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec"; |
|
17 | *category << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "June" << "Jul" << "Aug" << "Sep" << "Oct" << "Nov" << "Dec"; | |
18 |
|
18 | |||
19 | StackedBarChartSeries* series0 = new StackedBarChartSeries(category); |
|
19 | QStackedBarChartSeries* series0 = new QStackedBarChartSeries(category); | |
20 |
|
20 | |||
21 | QBarSet *set0 = new QBarSet; |
|
21 | QBarSet *set0 = new QBarSet; | |
22 | QBarSet *set1 = new QBarSet; |
|
22 | QBarSet *set1 = new QBarSet; |
@@ -1,4 +1,4 | |||||
1 |
#include "bar |
|
1 | #include "barpresenter.h" | |
2 | #include "bar_p.h" |
|
2 | #include "bar_p.h" | |
3 | #include "barlabel_p.h" |
|
3 | #include "barlabel_p.h" | |
4 | #include "qbarset.h" |
|
4 | #include "qbarset.h" | |
@@ -6,13 +6,13 | |||||
6 |
|
6 | |||
7 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
7 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
8 |
|
8 | |||
9 |
Bar |
|
9 | BarPresenter::BarPresenter(BarChartModel& model, QGraphicsItem *parent) : | |
10 |
Bar |
|
10 | BarPresenterBase(model,parent) | |
11 | { |
|
11 | { | |
12 | mBarDefaultWidth = 5; |
|
12 | mBarDefaultWidth = 5; | |
13 | } |
|
13 | } | |
14 |
|
14 | |||
15 |
void Bar |
|
15 | void BarPresenter::layoutChanged() | |
16 | { |
|
16 | { | |
17 | // qDebug() << "BarGroup::layoutChanged"; |
|
17 | // qDebug() << "BarGroup::layoutChanged"; | |
18 | // Scale bars to new layout |
|
18 | // Scale bars to new layout |
@@ -1,18 +1,18 | |||||
1 | #ifndef QBARGROUP_H |
|
1 | #ifndef QBARGROUP_H | |
2 | #define QBARGROUP_H |
|
2 | #define QBARGROUP_H | |
3 |
|
3 | |||
4 |
#include "bar |
|
4 | #include "barpresenterbase.h" | |
5 | #include "barchartseries.h" |
|
5 | #include "qbarchartseries.h" | |
6 | #include <QGraphicsItem> |
|
6 | #include <QGraphicsItem> | |
7 |
|
7 | |||
8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
9 |
|
9 | |||
10 | // Base class for bar groups |
|
10 | // Base class for bar groups | |
11 |
|
11 | |||
12 |
class Bar |
|
12 | class BarPresenter : public BarPresenterBase | |
13 | { |
|
13 | { | |
14 | public: |
|
14 | public: | |
15 |
explicit Bar |
|
15 | explicit BarPresenter(BarChartModel& model, QGraphicsItem *parent = 0); | |
16 |
|
16 | |||
17 | private: |
|
17 | private: | |
18 |
|
18 |
@@ -1,4 +1,4 | |||||
1 |
#include "bar |
|
1 | #include "barpresenterbase.h" | |
2 | #include "bar_p.h" |
|
2 | #include "bar_p.h" | |
3 | #include "barlabel_p.h" |
|
3 | #include "barlabel_p.h" | |
4 | #include "separator_p.h" |
|
4 | #include "separator_p.h" | |
@@ -6,7 +6,7 | |||||
6 |
|
6 | |||
7 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
7 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
8 |
|
8 | |||
9 |
Bar |
|
9 | BarPresenterBase::BarPresenterBase(BarChartModel& model, QGraphicsItem *parent) | |
10 | : ChartItem(parent) |
|
10 | : ChartItem(parent) | |
11 | ,mBarDefaultWidth(20) // TODO: remove hard coding, when we have layout code ready |
|
11 | ,mBarDefaultWidth(20) // TODO: remove hard coding, when we have layout code ready | |
12 | ,mLayoutSet(false) |
|
12 | ,mLayoutSet(false) | |
@@ -17,12 +17,12 BarGroupBase::BarGroupBase(BarChartModel& model, QGraphicsItem *parent) | |||||
17 | dataChanged(); |
|
17 | dataChanged(); | |
18 | } |
|
18 | } | |
19 |
|
19 | |||
20 |
void Bar |
|
20 | void BarPresenterBase::setSeparatorsVisible(bool visible) | |
21 | { |
|
21 | { | |
22 | mSeparatorsVisible = visible; |
|
22 | mSeparatorsVisible = visible; | |
23 | } |
|
23 | } | |
24 |
|
24 | |||
25 |
void Bar |
|
25 | void BarPresenterBase::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) | |
26 | { |
|
26 | { | |
27 | // qDebug() << "BarGroupBase::paint" << childItems().count(); |
|
27 | // qDebug() << "BarGroupBase::paint" << childItems().count(); | |
28 | if (!mLayoutSet) { |
|
28 | if (!mLayoutSet) { | |
@@ -37,12 +37,12 void BarGroupBase::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti | |||||
37 | // } |
|
37 | // } | |
38 | } |
|
38 | } | |
39 |
|
39 | |||
40 |
QRectF Bar |
|
40 | QRectF BarPresenterBase::boundingRect() const | |
41 | { |
|
41 | { | |
42 | return QRectF(0,0,mWidth,mHeight); |
|
42 | return QRectF(0,0,mWidth,mHeight); | |
43 | } |
|
43 | } | |
44 |
|
44 | |||
45 |
void Bar |
|
45 | void BarPresenterBase::setBarWidth( int w ) | |
46 | { |
|
46 | { | |
47 | mBarDefaultWidth = w; |
|
47 | mBarDefaultWidth = w; | |
48 | } |
|
48 | } | |
@@ -57,7 +57,7 void BarGroupBase::addBrush(QBrush brush) | |||||
57 | mBrushes.append(brush); |
|
57 | mBrushes.append(brush); | |
58 | } |
|
58 | } | |
59 | */ |
|
59 | */ | |
60 |
void Bar |
|
60 | void BarPresenterBase::dataChanged() | |
61 | { |
|
61 | { | |
62 | // TODO: performance optimizations. Do we really need to delete and create items every time data is changed or can we reuse them? |
|
62 | // TODO: performance optimizations. Do we really need to delete and create items every time data is changed or can we reuse them? | |
63 |
|
63 | |||
@@ -93,13 +93,13 void BarGroupBase::dataChanged() | |||||
93 |
|
93 | |||
94 | //handlers |
|
94 | //handlers | |
95 |
|
95 | |||
96 |
void Bar |
|
96 | void BarPresenterBase::handleModelChanged(int index) | |
97 | { |
|
97 | { | |
98 | // qDebug() << "BarGroupBase::handleModelChanged" << index; |
|
98 | // qDebug() << "BarGroupBase::handleModelChanged" << index; | |
99 | dataChanged(); |
|
99 | dataChanged(); | |
100 | } |
|
100 | } | |
101 |
|
101 | |||
102 |
void Bar |
|
102 | void BarPresenterBase::handleDomainChanged(const Domain& domain) | |
103 | { |
|
103 | { | |
104 | // qDebug() << "BarGroupBase::handleDomainChanged"; |
|
104 | // qDebug() << "BarGroupBase::handleDomainChanged"; | |
105 | // TODO: Figure out the use case for this. |
|
105 | // TODO: Figure out the use case for this. | |
@@ -107,7 +107,7 void BarGroupBase::handleDomainChanged(const Domain& domain) | |||||
107 | // layoutChanged(); |
|
107 | // layoutChanged(); | |
108 | } |
|
108 | } | |
109 |
|
109 | |||
110 |
void Bar |
|
110 | void BarPresenterBase::handleGeometryChanged(const QRectF& rect) | |
111 | { |
|
111 | { | |
112 | mWidth = rect.width(); |
|
112 | mWidth = rect.width(); | |
113 | mHeight = rect.height(); |
|
113 | mHeight = rect.height(); | |
@@ -116,6 +116,6 void BarGroupBase::handleGeometryChanged(const QRectF& rect) | |||||
116 | setPos(rect.topLeft()); |
|
116 | setPos(rect.topLeft()); | |
117 | } |
|
117 | } | |
118 |
|
118 | |||
119 |
#include "moc_bar |
|
119 | #include "moc_barpresenterbase.cpp" | |
120 |
|
120 | |||
121 | QTCOMMERCIALCHART_END_NAMESPACE |
|
121 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -10,11 +10,11 | |||||
10 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
10 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
11 |
|
11 | |||
12 | // Base Class for bar groups. Common implemantation of different groups. Not to be instantiated. |
|
12 | // Base Class for bar groups. Common implemantation of different groups. Not to be instantiated. | |
13 |
class Bar |
|
13 | class BarPresenterBase : public QObject, public ChartItem | |
14 | { |
|
14 | { | |
15 | Q_OBJECT |
|
15 | Q_OBJECT | |
16 | public: |
|
16 | public: | |
17 |
Bar |
|
17 | BarPresenterBase(BarChartModel& model, QGraphicsItem *parent = 0); | |
18 | void setSeparatorsVisible(bool visible = true); |
|
18 | void setSeparatorsVisible(bool visible = true); | |
19 |
|
19 | |||
20 | public: |
|
20 | public: |
@@ -1,4 +1,4 | |||||
1 |
#include "percentbar |
|
1 | #include "percentbarpresenter.h" | |
2 | #include "bar_p.h" |
|
2 | #include "bar_p.h" | |
3 | #include "barlabel_p.h" |
|
3 | #include "barlabel_p.h" | |
4 | #include "separator_p.h" |
|
4 | #include "separator_p.h" | |
@@ -8,12 +8,12 | |||||
8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
9 |
|
9 | |||
10 |
|
10 | |||
11 |
PercentBar |
|
11 | PercentBarPresenter::PercentBarPresenter(BarChartModel& model, QGraphicsItem *parent) : | |
12 |
Bar |
|
12 | BarPresenterBase(model, parent) | |
13 | { |
|
13 | { | |
14 | } |
|
14 | } | |
15 |
|
15 | |||
16 |
void PercentBar |
|
16 | void PercentBarPresenter::layoutChanged() | |
17 | { |
|
17 | { | |
18 | // qDebug() << "PercentBarGroup::layoutChanged"; |
|
18 | // qDebug() << "PercentBarGroup::layoutChanged"; | |
19 | // Scale bars to new layout |
|
19 | // Scale bars to new layout |
@@ -3,16 +3,16 | |||||
3 |
|
3 | |||
4 | #include "chartitem_p.h" |
|
4 | #include "chartitem_p.h" | |
5 | #include "bar_p.h" |
|
5 | #include "bar_p.h" | |
6 | #include "percentbarchartseries.h" |
|
6 | #include "qpercentbarchartseries.h" | |
7 |
#include "bar |
|
7 | #include "barpresenterbase.h" | |
8 | #include <QGraphicsItem> |
|
8 | #include <QGraphicsItem> | |
9 |
|
9 | |||
10 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
10 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
11 |
|
11 | |||
12 |
class PercentBar |
|
12 | class PercentBarPresenter : public BarPresenterBase | |
13 | { |
|
13 | { | |
14 | public: |
|
14 | public: | |
15 |
PercentBar |
|
15 | PercentBarPresenter(BarChartModel& model, QGraphicsItem *parent = 0); | |
16 |
|
16 | |||
17 | private: |
|
17 | private: | |
18 |
|
18 |
@@ -1,5 +1,5 | |||||
1 | #include <QDebug> |
|
1 | #include <QDebug> | |
2 | #include "barchartseries.h" |
|
2 | #include "qbarchartseries.h" | |
3 | #include "qbarcategory.h" |
|
3 | #include "qbarcategory.h" | |
4 | #include "qbarset.h" |
|
4 | #include "qbarset.h" | |
5 | #include "barchartmodel_p.h" |
|
5 | #include "barchartmodel_p.h" | |
@@ -7,63 +7,63 | |||||
7 |
|
7 | |||
8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
9 |
|
9 | |||
10 | BarChartSeries::BarChartSeries(QBarCategory *category, QObject *parent) |
|
10 | QBarChartSeries::QBarChartSeries(QBarCategory *category, QObject *parent) | |
11 | : QChartSeries(parent) |
|
11 | : QChartSeries(parent) | |
12 | ,mModel(new BarChartModel(category, this)) |
|
12 | ,mModel(new BarChartModel(category, this)) | |
13 | { |
|
13 | { | |
14 | } |
|
14 | } | |
15 |
|
15 | |||
16 | void BarChartSeries::addBarSet(QBarSet *set) |
|
16 | void QBarChartSeries::addBarSet(QBarSet *set) | |
17 | { |
|
17 | { | |
18 | mModel->addBarSet(set); |
|
18 | mModel->addBarSet(set); | |
19 | } |
|
19 | } | |
20 |
|
20 | |||
21 | void BarChartSeries::removeBarSet(QBarSet *set) |
|
21 | void QBarChartSeries::removeBarSet(QBarSet *set) | |
22 | { |
|
22 | { | |
23 | mModel->removeBarSet(set); |
|
23 | mModel->removeBarSet(set); | |
24 | } |
|
24 | } | |
25 |
|
25 | |||
26 | int BarChartSeries::countSets() |
|
26 | int QBarChartSeries::countSets() | |
27 | { |
|
27 | { | |
28 | return mModel->countSets(); |
|
28 | return mModel->countSets(); | |
29 | } |
|
29 | } | |
30 |
|
30 | |||
31 | QBarSet* BarChartSeries::nextSet(bool getFirst) |
|
31 | QBarSet* QBarChartSeries::nextSet(bool getFirst) | |
32 | { |
|
32 | { | |
33 | return mModel->nextSet(getFirst); |
|
33 | return mModel->nextSet(getFirst); | |
34 | } |
|
34 | } | |
35 |
|
35 | |||
36 | int BarChartSeries::countCategories() |
|
36 | int QBarChartSeries::countCategories() | |
37 | { |
|
37 | { | |
38 | return mModel->countCategories(); |
|
38 | return mModel->countCategories(); | |
39 | } |
|
39 | } | |
40 |
|
40 | |||
41 | qreal BarChartSeries::min() |
|
41 | qreal QBarChartSeries::min() | |
42 | { |
|
42 | { | |
43 | return mModel->min(); |
|
43 | return mModel->min(); | |
44 | } |
|
44 | } | |
45 |
|
45 | |||
46 | qreal BarChartSeries::max() |
|
46 | qreal QBarChartSeries::max() | |
47 | { |
|
47 | { | |
48 | return mModel->max(); |
|
48 | return mModel->max(); | |
49 | } |
|
49 | } | |
50 |
|
50 | |||
51 | qreal BarChartSeries::valueAt(int set, int category) |
|
51 | qreal QBarChartSeries::valueAt(int set, int category) | |
52 | { |
|
52 | { | |
53 | return mModel->valueAt(set,category); |
|
53 | return mModel->valueAt(set,category); | |
54 | } |
|
54 | } | |
55 |
|
55 | |||
56 | qreal BarChartSeries::maxCategorySum() |
|
56 | qreal QBarChartSeries::maxCategorySum() | |
57 | { |
|
57 | { | |
58 | return mModel->maxCategorySum(); |
|
58 | return mModel->maxCategorySum(); | |
59 | } |
|
59 | } | |
60 |
|
60 | |||
61 | BarChartModel& BarChartSeries::model() |
|
61 | BarChartModel& QBarChartSeries::model() | |
62 | { |
|
62 | { | |
63 | return *mModel; |
|
63 | return *mModel; | |
64 | } |
|
64 | } | |
65 |
|
65 | |||
66 |
|
66 | |||
67 | #include "moc_barchartseries.cpp" |
|
67 | #include "moc_qbarchartseries.cpp" | |
68 |
|
68 | |||
69 | QTCOMMERCIALCHART_END_NAMESPACE |
|
69 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -9,15 +9,15 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
9 |
|
9 | |||
10 | class QBarCategory; |
|
10 | class QBarCategory; | |
11 | class QBarSet; |
|
11 | class QBarSet; | |
12 |
class Bar |
|
12 | class BarPresenter; | |
13 | class BarChartModel; |
|
13 | class BarChartModel; | |
14 |
|
14 | |||
15 | // Container for series |
|
15 | // Container for series | |
16 | class QTCOMMERCIALCHART_EXPORT BarChartSeries : public QChartSeries |
|
16 | class QTCOMMERCIALCHART_EXPORT QBarChartSeries : public QChartSeries | |
17 | { |
|
17 | { | |
18 | Q_OBJECT |
|
18 | Q_OBJECT | |
19 | public: |
|
19 | public: | |
20 | BarChartSeries(QBarCategory *category, QObject* parent=0); |
|
20 | QBarChartSeries(QBarCategory *category, QObject* parent=0); | |
21 |
|
21 | |||
22 | virtual QChartSeriesType type() const { return QChartSeries::SeriesTypeBar; } |
|
22 | virtual QChartSeriesType type() const { return QChartSeries::SeriesTypeBar; } | |
23 |
|
23 | |||
@@ -46,7 +46,7 public Q_SLOTS: | |||||
46 |
|
46 | |||
47 | private: |
|
47 | private: | |
48 |
|
48 | |||
49 |
Bar |
|
49 | BarPresenter* mBarGroup; | |
50 | BarChartModel* mModel; |
|
50 | BarChartModel* mModel; | |
51 |
|
51 | |||
52 | }; |
|
52 | }; |
@@ -1,70 +1,70 | |||||
1 | #include <limits.h> |
|
1 | #include <limits.h> | |
2 | #include <QDebug> |
|
2 | #include <QDebug> | |
3 |
#include " |
|
3 | #include "qpercentbarchartseries.h" | |
4 | #include "qbarcategory.h" |
|
|||
5 | #include "qbarset.h" |
|
4 | #include "qbarset.h" | |
|
5 | #include "qbarcategory.h" | |||
6 | #include "barchartmodel_p.h" |
|
6 | #include "barchartmodel_p.h" | |
7 |
|
7 | |||
8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
9 |
|
9 | |||
10 |
|
|
10 | QPercentBarChartSeries::QPercentBarChartSeries(QBarCategory *category, QObject *parent) | |
11 | : QChartSeries(parent) |
|
11 | : QChartSeries(parent) | |
12 | ,mModel(new BarChartModel(category, this)) |
|
12 | ,mModel(new BarChartModel(category, this)) | |
13 | { |
|
13 | { | |
14 | } |
|
14 | } | |
15 |
|
15 | |||
16 |
void |
|
16 | void QPercentBarChartSeries::addBarSet(QBarSet *set) | |
17 | { |
|
17 | { | |
18 | mModel->addBarSet(set); |
|
18 | mModel->addBarSet(set); | |
19 | } |
|
19 | } | |
20 |
|
20 | |||
21 |
void |
|
21 | void QPercentBarChartSeries::removeBarSet(QBarSet *set) | |
22 | { |
|
22 | { | |
23 | mModel->removeBarSet(set); |
|
23 | mModel->removeBarSet(set); | |
24 | } |
|
24 | } | |
25 |
|
25 | |||
26 |
int |
|
26 | int QPercentBarChartSeries::countSets() | |
27 | { |
|
27 | { | |
28 | return mModel->countSets(); |
|
28 | return mModel->countSets(); | |
29 | } |
|
29 | } | |
30 |
|
30 | |||
31 |
QBarSet* |
|
31 | QBarSet* QPercentBarChartSeries::nextSet(bool getFirst) | |
32 | { |
|
32 | { | |
33 | return mModel->nextSet(getFirst); |
|
33 | return mModel->nextSet(getFirst); | |
34 | } |
|
34 | } | |
35 |
|
35 | |||
36 |
int |
|
36 | int QPercentBarChartSeries::countCategories() | |
37 | { |
|
37 | { | |
38 | return mModel->countCategories(); |
|
38 | return mModel->countCategories(); | |
39 | } |
|
39 | } | |
40 |
|
40 | |||
41 |
qreal |
|
41 | qreal QPercentBarChartSeries::min() | |
42 | { |
|
42 | { | |
43 | return mModel->min(); |
|
43 | return mModel->min(); | |
44 | } |
|
44 | } | |
45 |
|
45 | |||
46 |
qreal |
|
46 | qreal QPercentBarChartSeries::max() | |
47 | { |
|
47 | { | |
48 | return mModel->max(); |
|
48 | return mModel->max(); | |
49 | } |
|
49 | } | |
50 |
|
50 | |||
51 |
qreal |
|
51 | qreal QPercentBarChartSeries::valueAt(int set, int category) | |
52 | { |
|
52 | { | |
53 | return mModel->valueAt(set,category); |
|
53 | return mModel->valueAt(set,category); | |
54 | } |
|
54 | } | |
55 |
|
55 | |||
56 |
qreal |
|
56 | qreal QPercentBarChartSeries::maxCategorySum() | |
57 | { |
|
57 | { | |
58 | return mModel->maxCategorySum(); |
|
58 | return mModel->maxCategorySum(); | |
59 | } |
|
59 | } | |
60 |
|
60 | |||
61 |
BarChartModel& |
|
61 | BarChartModel& QPercentBarChartSeries::model() | |
62 | { |
|
62 | { | |
63 | return *mModel; |
|
63 | return *mModel; | |
64 | } |
|
64 | } | |
65 |
|
65 | |||
66 |
|
66 | |||
67 |
#include "moc_ |
|
67 | #include "moc_qpercentbarchartseries.cpp" | |
68 |
|
68 | |||
69 | QTCOMMERCIALCHART_END_NAMESPACE |
|
69 | QTCOMMERCIALCHART_END_NAMESPACE | |
70 |
|
70 |
@@ -7,16 +7,16 | |||||
7 |
|
7 | |||
8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
9 |
|
9 | |||
10 |
class PercentBar |
|
10 | class PercentBarPresenter; | |
11 | class QBarCategory; |
|
11 | class QBarCategory; | |
12 | class QBarSet; |
|
12 | class QBarSet; | |
13 | class BarChartModel; |
|
13 | class BarChartModel; | |
14 |
|
14 | |||
15 | class QTCOMMERCIALCHART_EXPORT PercentBarChartSeries : public QChartSeries |
|
15 | class QTCOMMERCIALCHART_EXPORT QPercentBarChartSeries : public QChartSeries | |
16 | { |
|
16 | { | |
17 | Q_OBJECT |
|
17 | Q_OBJECT | |
18 | public: |
|
18 | public: | |
19 | PercentBarChartSeries(QBarCategory *category, QObject* parent=0); |
|
19 | QPercentBarChartSeries(QBarCategory *category, QObject* parent=0); | |
20 |
|
20 | |||
21 | // from BarChartSeriesBase |
|
21 | // from BarChartSeriesBase | |
22 | virtual QChartSeriesType type() const { return QChartSeries::SeriesTypePercentBar; } |
|
22 | virtual QChartSeriesType type() const { return QChartSeries::SeriesTypePercentBar; } | |
@@ -47,7 +47,7 public Q_SLOTS: | |||||
47 |
|
47 | |||
48 | private: |
|
48 | private: | |
49 |
|
49 | |||
50 |
PercentBar |
|
50 | PercentBarPresenter* mPercentBarGroup; | |
51 | BarChartModel* mModel; |
|
51 | BarChartModel* mModel; | |
52 |
|
52 | |||
53 | }; |
|
53 | }; |
@@ -1,72 +1,70 | |||||
1 | #include "percentbarchartseries.h" |
|
|||
2 |
|
||||
3 |
|
|
1 | #include <limits.h> | |
4 | #include <QDebug> |
|
2 | #include <QDebug> | |
5 |
#include " |
|
3 | #include "qstackedbarchartseries.h" | |
6 | #include "qbarset.h" |
|
|||
7 | #include "qbarcategory.h" |
|
4 | #include "qbarcategory.h" | |
|
5 | #include "qbarset.h" | |||
8 | #include "barchartmodel_p.h" |
|
6 | #include "barchartmodel_p.h" | |
9 |
|
7 | |||
10 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
11 |
|
9 | |||
12 |
|
|
10 | QStackedBarChartSeries::QStackedBarChartSeries(QBarCategory *category, QObject *parent) | |
13 | : QChartSeries(parent) |
|
11 | : QChartSeries(parent) | |
14 | ,mModel(new BarChartModel(category, this)) |
|
12 | ,mModel(new BarChartModel(category, this)) | |
15 | { |
|
13 | { | |
16 | } |
|
14 | } | |
17 |
|
15 | |||
18 |
void |
|
16 | void QStackedBarChartSeries::addBarSet(QBarSet *set) | |
19 | { |
|
17 | { | |
20 | mModel->addBarSet(set); |
|
18 | mModel->addBarSet(set); | |
21 | } |
|
19 | } | |
22 |
|
20 | |||
23 |
void |
|
21 | void QStackedBarChartSeries::removeBarSet(QBarSet *set) | |
24 | { |
|
22 | { | |
25 | mModel->removeBarSet(set); |
|
23 | mModel->removeBarSet(set); | |
26 | } |
|
24 | } | |
27 |
|
25 | |||
28 |
int |
|
26 | int QStackedBarChartSeries::countSets() | |
29 | { |
|
27 | { | |
30 | return mModel->countSets(); |
|
28 | return mModel->countSets(); | |
31 | } |
|
29 | } | |
32 |
|
30 | |||
33 |
QBarSet* |
|
31 | QBarSet* QStackedBarChartSeries::nextSet(bool getFirst) | |
34 | { |
|
32 | { | |
35 | return mModel->nextSet(getFirst); |
|
33 | return mModel->nextSet(getFirst); | |
36 | } |
|
34 | } | |
37 |
|
35 | |||
38 |
int |
|
36 | int QStackedBarChartSeries::countCategories() | |
39 | { |
|
37 | { | |
40 | return mModel->countCategories(); |
|
38 | return mModel->countCategories(); | |
41 | } |
|
39 | } | |
42 |
|
40 | |||
43 |
qreal |
|
41 | qreal QStackedBarChartSeries::min() | |
44 | { |
|
42 | { | |
45 | return mModel->min(); |
|
43 | return mModel->min(); | |
46 | } |
|
44 | } | |
47 |
|
45 | |||
48 |
qreal |
|
46 | qreal QStackedBarChartSeries::max() | |
49 | { |
|
47 | { | |
50 | return mModel->max(); |
|
48 | return mModel->max(); | |
51 | } |
|
49 | } | |
52 |
|
50 | |||
53 |
qreal |
|
51 | qreal QStackedBarChartSeries::valueAt(int set, int category) | |
54 | { |
|
52 | { | |
55 | return mModel->valueAt(set,category); |
|
53 | return mModel->valueAt(set,category); | |
56 | } |
|
54 | } | |
57 |
|
55 | |||
58 |
qreal |
|
56 | qreal QStackedBarChartSeries::maxCategorySum() | |
59 | { |
|
57 | { | |
60 | return mModel->maxCategorySum(); |
|
58 | return mModel->maxCategorySum(); | |
61 | } |
|
59 | } | |
62 |
|
60 | |||
63 |
BarChartModel& |
|
61 | BarChartModel& QStackedBarChartSeries::model() | |
64 | { |
|
62 | { | |
65 | return *mModel; |
|
63 | return *mModel; | |
66 | } |
|
64 | } | |
67 |
|
65 | |||
68 |
|
66 | |||
69 |
#include "moc_ |
|
67 | #include "moc_qstackedbarchartseries.cpp" | |
70 |
|
68 | |||
71 | QTCOMMERCIALCHART_END_NAMESPACE |
|
69 | QTCOMMERCIALCHART_END_NAMESPACE | |
72 |
|
70 |
@@ -7,16 +7,16 | |||||
7 |
|
7 | |||
8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
9 |
|
9 | |||
10 |
class StackedBar |
|
10 | class StackedBarPresenter; | |
11 | class QBarCategory; |
|
11 | class QBarCategory; | |
12 | class QBarSet; |
|
12 | class QBarSet; | |
13 | class BarChartModel; |
|
13 | class BarChartModel; | |
14 |
|
14 | |||
15 | class QTCOMMERCIALCHART_EXPORT StackedBarChartSeries : public QChartSeries |
|
15 | class QTCOMMERCIALCHART_EXPORT QStackedBarChartSeries : public QChartSeries | |
16 | { |
|
16 | { | |
17 | Q_OBJECT |
|
17 | Q_OBJECT | |
18 | public: |
|
18 | public: | |
19 | StackedBarChartSeries(QBarCategory *category, QObject* parent=0); |
|
19 | QStackedBarChartSeries(QBarCategory *category, QObject* parent=0); | |
20 |
|
20 | |||
21 | // from QChartSeries |
|
21 | // from QChartSeries | |
22 | virtual QChartSeriesType type() const { return QChartSeries::SeriesTypeStackedBar; } |
|
22 | virtual QChartSeriesType type() const { return QChartSeries::SeriesTypeStackedBar; } | |
@@ -46,7 +46,7 public Q_SLOTS: | |||||
46 |
|
46 | |||
47 | private: |
|
47 | private: | |
48 |
|
48 | |||
49 |
StackedBar |
|
49 | StackedBarPresenter* mStackedBarGroup; | |
50 | BarChartModel* mModel; |
|
50 | BarChartModel* mModel; | |
51 | }; |
|
51 | }; | |
52 |
|
52 |
@@ -1,4 +1,4 | |||||
1 |
#include "stackedbar |
|
1 | #include "stackedbarpresenter.h" | |
2 | #include "bar_p.h" |
|
2 | #include "bar_p.h" | |
3 | #include "barlabel_p.h" |
|
3 | #include "barlabel_p.h" | |
4 | #include "separator_p.h" |
|
4 | #include "separator_p.h" | |
@@ -7,12 +7,12 | |||||
7 |
|
7 | |||
8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
9 |
|
9 | |||
10 |
StackedBar |
|
10 | StackedBarPresenter::StackedBarPresenter(BarChartModel& model, QGraphicsItem *parent) : | |
11 |
Bar |
|
11 | BarPresenterBase(model,parent) | |
12 | { |
|
12 | { | |
13 | } |
|
13 | } | |
14 |
|
14 | |||
15 |
void StackedBar |
|
15 | void StackedBarPresenter::layoutChanged() | |
16 | { |
|
16 | { | |
17 | // qDebug() << "StackedBarGroup::layoutChanged"; |
|
17 | // qDebug() << "StackedBarGroup::layoutChanged"; | |
18 | // Scale bars to new layout |
|
18 | // Scale bars to new layout |
@@ -1,16 +1,16 | |||||
1 | #ifndef STACKEDBARGROUP_H |
|
1 | #ifndef STACKEDBARGROUP_H | |
2 | #define STACKEDBARGROUP_H |
|
2 | #define STACKEDBARGROUP_H | |
3 |
|
3 | |||
4 |
#include "bar |
|
4 | #include "barpresenterbase.h" | |
5 | #include "stackedbarchartseries.h" |
|
5 | #include "qstackedbarchartseries.h" | |
6 | #include <QGraphicsItem> |
|
6 | #include <QGraphicsItem> | |
7 |
|
7 | |||
8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
9 |
|
9 | |||
10 |
class StackedBar |
|
10 | class StackedBarPresenter : public BarPresenterBase | |
11 | { |
|
11 | { | |
12 | public: |
|
12 | public: | |
13 |
StackedBar |
|
13 | StackedBarPresenter(BarChartModel& model, QGraphicsItem *parent = 0); | |
14 |
|
14 | |||
15 | private: |
|
15 | private: | |
16 | // From BarGroupBase |
|
16 | // From BarGroupBase |
@@ -1,9 +1,9 | |||||
1 | #include "chartdataset_p.h" |
|
1 | #include "chartdataset_p.h" | |
2 | //series |
|
2 | //series | |
3 | #include "qlinechartseries.h" |
|
3 | #include "qlinechartseries.h" | |
4 | #include "barchartseries.h" |
|
4 | #include "qbarchartseries.h" | |
5 | #include "stackedbarchartseries.h" |
|
5 | #include "qstackedbarchartseries.h" | |
6 | #include "percentbarchartseries.h" |
|
6 | #include "qpercentbarchartseries.h" | |
7 | #include "qpieseries.h" |
|
7 | #include "qpieseries.h" | |
8 | #include "qscatterseries.h" |
|
8 | #include "qscatterseries.h" | |
9 |
|
9 | |||
@@ -54,7 +54,7 void ChartDataSet::addSeries(QChartSeries* series) | |||||
54 | } |
|
54 | } | |
55 | case QChartSeries::SeriesTypeBar: { |
|
55 | case QChartSeries::SeriesTypeBar: { | |
56 | qDebug() << "QChartSeries::SeriesTypeBar"; |
|
56 | qDebug() << "QChartSeries::SeriesTypeBar"; | |
57 | BarChartSeries* barSeries = static_cast<BarChartSeries*>(series); |
|
57 | QBarChartSeries* barSeries = static_cast<QBarChartSeries*>(series); | |
58 | qreal x = barSeries->countCategories(); |
|
58 | qreal x = barSeries->countCategories(); | |
59 | qreal y = barSeries->max(); |
|
59 | qreal y = barSeries->max(); | |
60 | domain.m_minX = qMin(domain.m_minX,x); |
|
60 | domain.m_minX = qMin(domain.m_minX,x); | |
@@ -66,7 +66,7 void ChartDataSet::addSeries(QChartSeries* series) | |||||
66 | case QChartSeries::SeriesTypeStackedBar: { |
|
66 | case QChartSeries::SeriesTypeStackedBar: { | |
67 | qDebug() << "QChartSeries::SeriesTypeStackedBar"; |
|
67 | qDebug() << "QChartSeries::SeriesTypeStackedBar"; | |
68 |
|
68 | |||
69 | StackedBarChartSeries* stackedBarSeries = static_cast<StackedBarChartSeries*>(series); |
|
69 | QStackedBarChartSeries* stackedBarSeries = static_cast<QStackedBarChartSeries*>(series); | |
70 | qreal x = stackedBarSeries->countCategories(); |
|
70 | qreal x = stackedBarSeries->countCategories(); | |
71 | qreal y = stackedBarSeries->maxCategorySum(); |
|
71 | qreal y = stackedBarSeries->maxCategorySum(); | |
72 | domain.m_minX = qMin(domain.m_minX,x); |
|
72 | domain.m_minX = qMin(domain.m_minX,x); | |
@@ -78,7 +78,7 void ChartDataSet::addSeries(QChartSeries* series) | |||||
78 | case QChartSeries::SeriesTypePercentBar: { |
|
78 | case QChartSeries::SeriesTypePercentBar: { | |
79 | qDebug() << "QChartSeries::SeriesTypePercentBar"; |
|
79 | qDebug() << "QChartSeries::SeriesTypePercentBar"; | |
80 |
|
80 | |||
81 | PercentBarChartSeries* percentBarSeries = static_cast<PercentBarChartSeries*>(series); |
|
81 | QPercentBarChartSeries* percentBarSeries = static_cast<QPercentBarChartSeries*>(series); | |
82 | qreal x = percentBarSeries->countCategories(); |
|
82 | qreal x = percentBarSeries->countCategories(); | |
83 | domain.m_minX = qMin(domain.m_minX,x); |
|
83 | domain.m_minX = qMin(domain.m_minX,x); | |
84 | domain.m_minY = 0; |
|
84 | domain.m_minY = 0; |
@@ -4,18 +4,18 | |||||
4 | #include "chartdataset_p.h" |
|
4 | #include "chartdataset_p.h" | |
5 | #include "charttheme_p.h" |
|
5 | #include "charttheme_p.h" | |
6 | //series |
|
6 | //series | |
7 | #include "barchartseries.h" |
|
7 | #include "qbarchartseries.h" | |
8 | #include "stackedbarchartseries.h" |
|
8 | #include "qstackedbarchartseries.h" | |
9 | #include "percentbarchartseries.h" |
|
9 | #include "qpercentbarchartseries.h" | |
10 | #include "qlinechartseries.h" |
|
10 | #include "qlinechartseries.h" | |
11 | #include "qpieseries.h" |
|
11 | #include "qpieseries.h" | |
12 | #include "qscatterseries.h" |
|
12 | #include "qscatterseries.h" | |
13 | //items |
|
13 | //items | |
14 | #include "axisitem_p.h" |
|
14 | #include "axisitem_p.h" | |
15 |
#include "bar |
|
15 | #include "barpresenter.h" | |
16 |
#include "stackedbar |
|
16 | #include "stackedbarpresenter.h" | |
17 | #include "linechartitem_p.h" |
|
17 | #include "linechartitem_p.h" | |
18 |
#include "percentbar |
|
18 | #include "percentbarpresenter.h" | |
19 | #include "linechartanimationitem_p.h" |
|
19 | #include "linechartanimationitem_p.h" | |
20 | #include "piepresenter.h" |
|
20 | #include "piepresenter.h" | |
21 | #include "scatterpresenter_p.h" |
|
21 | #include "scatterpresenter_p.h" | |
@@ -85,8 +85,8 void ChartPresenter::handleSeriesAdded(QChartSeries* series) | |||||
85 | } |
|
85 | } | |
86 |
|
86 | |||
87 | case QChartSeries::SeriesTypeBar: { |
|
87 | case QChartSeries::SeriesTypeBar: { | |
88 | BarChartSeries* barSeries = static_cast<BarChartSeries*>(series); |
|
88 | QBarChartSeries* barSeries = static_cast<QBarChartSeries*>(series); | |
89 |
Bar |
|
89 | BarPresenter* item = new BarPresenter(barSeries->model(),m_chart); | |
90 | m_chartTheme->decorate(item,barSeries,m_chartItems.count()); |
|
90 | m_chartTheme->decorate(item,barSeries,m_chartItems.count()); | |
91 | QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),item,SLOT(handleGeometryChanged(const QRectF&))); |
|
91 | QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),item,SLOT(handleGeometryChanged(const QRectF&))); | |
92 | QObject::connect(m_dataset,SIGNAL(domainChanged(const Domain&)),item,SLOT(handleDomainChanged(const Domain&))); |
|
92 | QObject::connect(m_dataset,SIGNAL(domainChanged(const Domain&)),item,SLOT(handleDomainChanged(const Domain&))); | |
@@ -98,8 +98,8 void ChartPresenter::handleSeriesAdded(QChartSeries* series) | |||||
98 |
|
98 | |||
99 | case QChartSeries::SeriesTypeStackedBar: { |
|
99 | case QChartSeries::SeriesTypeStackedBar: { | |
100 |
|
100 | |||
101 | StackedBarChartSeries* stackedBarSeries = static_cast<StackedBarChartSeries*>(series); |
|
101 | QStackedBarChartSeries* stackedBarSeries = static_cast<QStackedBarChartSeries*>(series); | |
102 |
StackedBar |
|
102 | StackedBarPresenter* item = new StackedBarPresenter(stackedBarSeries->model(),m_chart); | |
103 | m_chartTheme->decorate(item,stackedBarSeries,m_chartItems.count()); |
|
103 | m_chartTheme->decorate(item,stackedBarSeries,m_chartItems.count()); | |
104 | QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),item,SLOT(handleGeometryChanged(const QRectF&))); |
|
104 | QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),item,SLOT(handleGeometryChanged(const QRectF&))); | |
105 | QObject::connect(m_dataset,SIGNAL(domainChanged(const Domain&)),item,SLOT(handleDomainChanged(const Domain&))); |
|
105 | QObject::connect(m_dataset,SIGNAL(domainChanged(const Domain&)),item,SLOT(handleDomainChanged(const Domain&))); | |
@@ -110,8 +110,8 void ChartPresenter::handleSeriesAdded(QChartSeries* series) | |||||
110 |
|
110 | |||
111 | case QChartSeries::SeriesTypePercentBar: { |
|
111 | case QChartSeries::SeriesTypePercentBar: { | |
112 |
|
112 | |||
113 | PercentBarChartSeries* percentBarSeries = static_cast<PercentBarChartSeries*>(series); |
|
113 | QPercentBarChartSeries* percentBarSeries = static_cast<QPercentBarChartSeries*>(series); | |
114 |
PercentBar |
|
114 | PercentBarPresenter* item = new PercentBarPresenter(percentBarSeries->model(),m_chart); | |
115 | m_chartTheme->decorate(item,percentBarSeries ,m_chartItems.count()); |
|
115 | m_chartTheme->decorate(item,percentBarSeries ,m_chartItems.count()); | |
116 | QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),item,SLOT(handleGeometryChanged(const QRectF&))); |
|
116 | QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),item,SLOT(handleGeometryChanged(const QRectF&))); | |
117 | QObject::connect(m_dataset,SIGNAL(domainChanged(const Domain&)),item,SLOT(handleDomainChanged(const Domain&))); |
|
117 | QObject::connect(m_dataset,SIGNAL(domainChanged(const Domain&)),item,SLOT(handleDomainChanged(const Domain&))); |
@@ -5,9 +5,9 | |||||
5 |
|
5 | |||
6 | //series |
|
6 | //series | |
7 | #include "qbarset.h" |
|
7 | #include "qbarset.h" | |
8 | #include "barchartseries.h" |
|
8 | #include "qbarchartseries.h" | |
9 | #include "stackedbarchartseries.h" |
|
9 | #include "qstackedbarchartseries.h" | |
10 | #include "percentbarchartseries.h" |
|
10 | #include "qpercentbarchartseries.h" | |
11 | #include "qlinechartseries.h" |
|
11 | #include "qlinechartseries.h" | |
12 | #include "qscatterseries.h" |
|
12 | #include "qscatterseries.h" | |
13 | #include "qpieseries.h" |
|
13 | #include "qpieseries.h" | |
@@ -15,10 +15,10 | |||||
15 |
|
15 | |||
16 | //items |
|
16 | //items | |
17 | #include "axisitem_p.h" |
|
17 | #include "axisitem_p.h" | |
18 |
#include "bar |
|
18 | #include "barpresenter.h" | |
19 |
#include "stackedbar |
|
19 | #include "stackedbarpresenter.h" | |
20 | #include "linechartitem_p.h" |
|
20 | #include "linechartitem_p.h" | |
21 |
#include "percentbar |
|
21 | #include "percentbarpresenter.h" | |
22 | #include "scatterpresenter_p.h" |
|
22 | #include "scatterpresenter_p.h" | |
23 | #include "piepresenter.h" |
|
23 | #include "piepresenter.h" | |
24 |
|
24 | |||
@@ -89,20 +89,20 void ChartTheme::decorate(ChartItem* item, QChartSeries* series,int count) | |||||
89 | break; |
|
89 | break; | |
90 | } |
|
90 | } | |
91 | case QChartSeries::SeriesTypeBar: { |
|
91 | case QChartSeries::SeriesTypeBar: { | |
92 | BarChartSeries* b = static_cast<BarChartSeries*>(series); |
|
92 | QBarChartSeries* b = static_cast<QBarChartSeries*>(series); | |
93 |
Bar |
|
93 | BarPresenter* i = static_cast<BarPresenter*>(item); | |
94 | decorate(i,b,count); |
|
94 | decorate(i,b,count); | |
95 | break; |
|
95 | break; | |
96 | } |
|
96 | } | |
97 | case QChartSeries::SeriesTypeStackedBar: { |
|
97 | case QChartSeries::SeriesTypeStackedBar: { | |
98 | StackedBarChartSeries* s = static_cast<StackedBarChartSeries*>(series); |
|
98 | QStackedBarChartSeries* s = static_cast<QStackedBarChartSeries*>(series); | |
99 |
StackedBar |
|
99 | StackedBarPresenter* i = static_cast<StackedBarPresenter*>(item); | |
100 | decorate(i,s,count); |
|
100 | decorate(i,s,count); | |
101 | break; |
|
101 | break; | |
102 | } |
|
102 | } | |
103 | case QChartSeries::SeriesTypePercentBar: { |
|
103 | case QChartSeries::SeriesTypePercentBar: { | |
104 | PercentBarChartSeries* s = static_cast<PercentBarChartSeries*>(series); |
|
104 | QPercentBarChartSeries* s = static_cast<QPercentBarChartSeries*>(series); | |
105 |
PercentBar |
|
105 | PercentBarPresenter* i = static_cast<PercentBarPresenter*>(item); | |
106 | decorate(i,s,count); |
|
106 | decorate(i,s,count); | |
107 | break; |
|
107 | break; | |
108 | } |
|
108 | } | |
@@ -139,21 +139,21 void ChartTheme::decorate(LineChartItem* item, QLineChartSeries* series,int coun | |||||
139 | item->setPen(pen); |
|
139 | item->setPen(pen); | |
140 | } |
|
140 | } | |
141 |
|
141 | |||
142 |
void ChartTheme::decorate(Bar |
|
142 | void ChartTheme::decorate(BarPresenter* item, QBarChartSeries* series,int count) | |
143 | { |
|
143 | { | |
144 | for (int i=0; i<series->countSets(); i++) { |
|
144 | for (int i=0; i<series->countSets(); i++) { | |
145 | series->nextSet(0==i)->setBrush(QBrush(m_seriesColor.at(i%m_seriesColor.count()))); |
|
145 | series->nextSet(0==i)->setBrush(QBrush(m_seriesColor.at(i%m_seriesColor.count()))); | |
146 | } |
|
146 | } | |
147 | } |
|
147 | } | |
148 |
|
148 | |||
149 |
void ChartTheme::decorate(StackedBar |
|
149 | void ChartTheme::decorate(StackedBarPresenter* item, QStackedBarChartSeries* series,int count) | |
150 | { |
|
150 | { | |
151 | for (int i=0; i<series->countSets(); i++) { |
|
151 | for (int i=0; i<series->countSets(); i++) { | |
152 | series->nextSet(0==i)->setBrush(QBrush(m_seriesColor.at(i%m_seriesColor.count()))); |
|
152 | series->nextSet(0==i)->setBrush(QBrush(m_seriesColor.at(i%m_seriesColor.count()))); | |
153 | } |
|
153 | } | |
154 | } |
|
154 | } | |
155 |
|
155 | |||
156 |
void ChartTheme::decorate(PercentBar |
|
156 | void ChartTheme::decorate(PercentBarPresenter* item, QPercentBarChartSeries* series,int count) | |
157 | { |
|
157 | { | |
158 | for (int i=0; i<series->countSets(); i++) { |
|
158 | for (int i=0; i<series->countSets(); i++) { | |
159 | series->nextSet(0==i)->setBrush(QBrush(m_seriesColor.at(i%m_seriesColor.count()))); |
|
159 | series->nextSet(0==i)->setBrush(QBrush(m_seriesColor.at(i%m_seriesColor.count()))); |
@@ -11,12 +11,12 class ChartItem; | |||||
11 | class QChartSeries; |
|
11 | class QChartSeries; | |
12 | class LineChartItem; |
|
12 | class LineChartItem; | |
13 | class QLineChartSeries; |
|
13 | class QLineChartSeries; | |
14 |
class Bar |
|
14 | class BarPresenter; | |
15 | class BarChartSeries; |
|
15 | class QBarChartSeries; | |
16 |
class StackedBar |
|
16 | class StackedBarPresenter; | |
17 | class StackedBarChartSeries; |
|
17 | class QStackedBarChartSeries; | |
18 | class PercentBarChartSeries; |
|
18 | class QPercentBarChartSeries; | |
19 |
class PercentBar |
|
19 | class PercentBarPresenter; | |
20 | class QScatterSeries; |
|
20 | class QScatterSeries; | |
21 | class ScatterPresenter; |
|
21 | class ScatterPresenter; | |
22 | class PiePresenter; |
|
22 | class PiePresenter; | |
@@ -32,9 +32,9 public: | |||||
32 | void decorate(QChart* chart); |
|
32 | void decorate(QChart* chart); | |
33 | void decorate(ChartItem* item, QChartSeries* series,int count); |
|
33 | void decorate(ChartItem* item, QChartSeries* series,int count); | |
34 | void decorate(LineChartItem* item, QLineChartSeries*, int count); |
|
34 | void decorate(LineChartItem* item, QLineChartSeries*, int count); | |
35 |
void decorate(Bar |
|
35 | void decorate(BarPresenter* item, QBarChartSeries* series,int count); | |
36 |
void decorate(StackedBar |
|
36 | void decorate(StackedBarPresenter* item, QStackedBarChartSeries* series,int count); | |
37 |
void decorate(PercentBar |
|
37 | void decorate(PercentBarPresenter* item, QPercentBarChartSeries* series,int count); | |
38 | void decorate(ScatterPresenter* presenter, QScatterSeries* series, int count); |
|
38 | void decorate(ScatterPresenter* presenter, QScatterSeries* series, int count); | |
39 | void decorate(PiePresenter* item, QPieSeries* series, int count); |
|
39 | void decorate(PiePresenter* item, QPieSeries* series, int count); | |
40 | void decorate(QChartAxis& axis,AxisItem* item); |
|
40 | void decorate(QChartAxis& axis,AxisItem* item); |
@@ -4,9 +4,9 | |||||
4 | #include "chartdataset_p.h" |
|
4 | #include "chartdataset_p.h" | |
5 |
|
5 | |||
6 | //series |
|
6 | //series | |
7 | #include "barchartseries.h" |
|
7 | #include "qbarchartseries.h" | |
8 | #include "stackedbarchartseries.h" |
|
8 | #include "qstackedbarchartseries.h" | |
9 | #include "percentbarchartseries.h" |
|
9 | #include "qpercentbarchartseries.h" | |
10 | #include "qlinechartseries.h" |
|
10 | #include "qlinechartseries.h" | |
11 | #include "qscatterseries.h" |
|
11 | #include "qscatterseries.h" | |
12 | //#include "scatterseries_p.h" |
|
12 | //#include "scatterseries_p.h" |
@@ -14,7 +14,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
14 | class AxisItem; |
|
14 | class AxisItem; | |
15 | class QChartSeries; |
|
15 | class QChartSeries; | |
16 | class PlotDomain; |
|
16 | class PlotDomain; | |
17 |
class Bar |
|
17 | class BarPresenter; | |
18 | class QChartAxis; |
|
18 | class QChartAxis; | |
19 | class ChartTheme; |
|
19 | class ChartTheme; | |
20 | class ChartItem; |
|
20 | class ChartItem; |
@@ -6,19 +6,20 QT += core \ | |||||
6 | gui |
|
6 | gui | |
7 | CONFIG += debug_and_release |
|
7 | CONFIG += debug_and_release | |
8 | CONFIG(debug, debug|release):TARGET = QtCommercialChartd |
|
8 | CONFIG(debug, debug|release):TARGET = QtCommercialChartd | |
9 | SOURCES += barchart/barchartseries.cpp \ |
|
9 | SOURCES += \ | |
10 | barchart/bargroup.cpp \ |
|
|||
11 | barchart/bar.cpp \ |
|
10 | barchart/bar.cpp \ | |
12 | barchart/stackedbarchartseries.cpp \ |
|
|||
13 | barchart/stackedbargroup.cpp \ |
|
|||
14 | barchart/percentbarchartseries.cpp \ |
|
|||
15 | barchart/percentbargroup.cpp \ |
|
|||
16 | barchart/barlabel.cpp \ |
|
11 | barchart/barlabel.cpp \ | |
17 | barchart/barchartmodel.cpp \ |
|
12 | barchart/barchartmodel.cpp \ | |
18 | barchart/separator.cpp \ |
|
13 | barchart/separator.cpp \ | |
19 | barchart/bargroupbase.cpp \ |
|
|||
20 | barchart/qbarset.cpp \ |
|
14 | barchart/qbarset.cpp \ | |
21 | barchart/qbarcategory.cpp \ |
|
15 | barchart/qbarcategory.cpp \ | |
|
16 | barchart/qbarchartseries.cpp \ | |||
|
17 | barchart/qpercentbarchartseries.cpp \ | |||
|
18 | barchart/qstackedbarchartseries.cpp \ | |||
|
19 | barchart/barpresenterbase.cpp \ | |||
|
20 | barchart/barpresenter.cpp \ | |||
|
21 | barchart/stackedbarpresenter.cpp \ | |||
|
22 | barchart/percentbarpresenter.cpp \ | |||
22 | linechart/linechartanimationitem.cpp \ |
|
23 | linechart/linechartanimationitem.cpp \ | |
23 | linechart/linechartitem.cpp \ |
|
24 | linechart/linechartitem.cpp \ | |
24 | linechart/qlinechartseries.cpp \ |
|
25 | linechart/qlinechartseries.cpp \ | |
@@ -44,13 +45,13 PRIVATE_HEADERS += linechart/linechartitem_p.h \ | |||||
44 | chartpresenter_p.h \ |
|
45 | chartpresenter_p.h \ | |
45 | domain_p.h |
|
46 | domain_p.h | |
46 | PUBLIC_HEADERS += linechart/qlinechartseries.h \ |
|
47 | PUBLIC_HEADERS += linechart/qlinechartseries.h \ | |
47 | barchart/barchartseries.h \ |
|
48 | barchart/qbarchartseries.h \ | |
48 |
barchart/bar |
|
49 | barchart/barpresenter.h \ | |
49 | barchart/stackedbarchartseries.h \ |
|
50 | barchart/qstackedbarchartseries.h \ | |
50 |
barchart/stackedbar |
|
51 | barchart/stackedbarpresenter.h \ | |
51 | barchart/percentbarchartseries.h \ |
|
52 | barchart/qpercentbarchartseries.h \ | |
52 |
barchart/percentbar |
|
53 | barchart/percentbarpresenter.h \ | |
53 |
barchart/bar |
|
54 | barchart/barpresenterbase.h \ | |
54 | barchart/qbarset.h \ |
|
55 | barchart/qbarset.h \ | |
55 | barchart/qbarcategory.h \ |
|
56 | barchart/qbarcategory.h \ | |
56 | qchartseries.h \ |
|
57 | qchartseries.h \ |
@@ -6,9 +6,9 | |||||
6 | #include <qlinechartseries.h> |
|
6 | #include <qlinechartseries.h> | |
7 | #include <qbarset.h> |
|
7 | #include <qbarset.h> | |
8 | #include <qbarcategory.h> |
|
8 | #include <qbarcategory.h> | |
9 | #include <barchartseries.h> |
|
9 | #include <qbarchartseries.h> | |
10 | #include <stackedbarchartseries.h> |
|
10 | #include <qstackedbarchartseries.h> | |
11 | #include <percentbarchartseries.h> |
|
11 | #include <qpercentbarchartseries.h> | |
12 | #include <QPushButton> |
|
12 | #include <QPushButton> | |
13 | #include <QComboBox> |
|
13 | #include <QComboBox> | |
14 | #include <QSpinBox> |
|
14 | #include <QSpinBox> |
General Comments 0
You need to be logged in to leave comments.
Login now