@@ -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 <qbar |
|
4 | #include <qbarseries.h> | |
5 | #include <qbarset.h> |
|
5 | #include <qbarset.h> | |
6 | #include <qbarcategory.h> |
|
6 | #include <qbarcategory.h> | |
7 |
|
7 | |||
@@ -36,7 +36,7 int main(int argc, char *argv[]) | |||||
36 |
|
36 | |||
37 | //! [3] |
|
37 | //! [3] | |
38 | // Create series and add sets to it |
|
38 | // Create series and add sets to it | |
39 |
QBar |
|
39 | QBarSeries* series= new QBarSeries(category); | |
40 |
|
40 | |||
41 | series->addBarSet(set0); |
|
41 | series->addBarSet(set0); | |
42 | series->addBarSet(set1); |
|
42 | series->addBarSet(set1); |
@@ -4,7 +4,7 | |||||
4 | #include <qchartview.h> |
|
4 | #include <qchartview.h> | |
5 | #include <qlinechartseries.h> |
|
5 | #include <qlinechartseries.h> | |
6 | #include <qscatterseries.h> |
|
6 | #include <qscatterseries.h> | |
7 |
#include <qbar |
|
7 | #include <qbarseries.h> | |
8 | #include <qbarset.h> |
|
8 | #include <qbarset.h> | |
9 | #include <qbarcategory.h> |
|
9 | #include <qbarcategory.h> | |
10 | #include <qpieseries.h> |
|
10 | #include <qpieseries.h> | |
@@ -59,7 +59,7 int main(int argc, char *argv[]) | |||||
59 | *barCategory << "Jan" |
|
59 | *barCategory << "Jan" | |
60 | << "Feb" |
|
60 | << "Feb" | |
61 | << "Mar"; |
|
61 | << "Mar"; | |
62 |
QBar |
|
62 | QBarSeries *bar = new QBarSeries(barCategory); | |
63 | QBarSet *barSet = new QBarSet("Sales"); |
|
63 | QBarSet *barSet = new QBarSet("Sales"); | |
64 | *barSet << 123.2 |
|
64 | *barSet << 123.2 | |
65 | << 301.3 |
|
65 | << 301.3 |
@@ -124,7 +124,7 void Widget::refreshChart() | |||||
124 | QBarCategory* category = new QBarCategory; |
|
124 | QBarCategory* category = new QBarCategory; | |
125 | for (int i = 0; i < selectedCountriesStrings.size(); i++) |
|
125 | for (int i = 0; i < selectedCountriesStrings.size(); i++) | |
126 | *category << selectedCountriesStrings[i]; |
|
126 | *category << selectedCountriesStrings[i]; | |
127 |
series0 = new QBar |
|
127 | series0 = new QBarSeries(category); | |
128 |
|
128 | |||
129 | // prepare the selected counries SQL query |
|
129 | // prepare the selected counries SQL query | |
130 | QString countriesQuery = "country IN ("; |
|
130 | QString countriesQuery = "country IN ("; |
@@ -3,7 +3,7 | |||||
3 |
|
3 | |||
4 | #include <QtGui/QWidget> |
|
4 | #include <QtGui/QWidget> | |
5 | #include <qchartview.h> |
|
5 | #include <qchartview.h> | |
6 |
#include <qbar |
|
6 | #include <qbarseries.h> | |
7 | #include <QSqlDatabase> |
|
7 | #include <QSqlDatabase> | |
8 |
|
8 | |||
9 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
9 | QTCOMMERCIALCHART_USE_NAMESPACE | |
@@ -28,7 +28,7 private: | |||||
28 | QListWidget* countrieslist; |
|
28 | QListWidget* countrieslist; | |
29 | QListWidget* yearslist; |
|
29 | QListWidget* yearslist; | |
30 | QSqlDatabase db; |
|
30 | QSqlDatabase db; | |
31 |
QBar |
|
31 | QBarSeries* series0; | |
32 | QRadioButton* barChartRadioButton; |
|
32 | QRadioButton* barChartRadioButton; | |
33 | QRadioButton* scatterChartRadioButton; |
|
33 | QRadioButton* scatterChartRadioButton; | |
34 | }; |
|
34 | }; |
@@ -1,7 +1,7 | |||||
1 | #include <QApplication> |
|
1 | #include <QApplication> | |
2 | #include <QMainWindow> |
|
2 | #include <QMainWindow> | |
3 | #include <QStandardItemModel> |
|
3 | #include <QStandardItemModel> | |
4 |
#include <qpercentbar |
|
4 | #include <qpercentbarseries.h> | |
5 | #include <qbarcategory.h> |
|
5 | #include <qbarcategory.h> | |
6 | #include <qchartview.h> |
|
6 | #include <qchartview.h> | |
7 | #include <qbarset.h> |
|
7 | #include <qbarset.h> | |
@@ -36,7 +36,7 int main(int argc, char *argv[]) | |||||
36 |
|
36 | |||
37 | //! [3] |
|
37 | //! [3] | |
38 | // Create series and add sets to it |
|
38 | // Create series and add sets to it | |
39 |
QPercentBar |
|
39 | QPercentBarSeries* series = new QPercentBarSeries(category); | |
40 |
|
40 | |||
41 | series->addBarSet(set0); |
|
41 | series->addBarSet(set0); | |
42 | series->addBarSet(set1); |
|
42 | series->addBarSet(set1); |
@@ -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 <qstackedbar |
|
4 | #include <qstackedbarseries.h> | |
5 | #include <qbarset.h> |
|
5 | #include <qbarset.h> | |
6 | #include <qbarcategory.h> |
|
6 | #include <qbarcategory.h> | |
7 |
|
7 | |||
@@ -35,7 +35,7 int main(int argc, char *argv[]) | |||||
35 |
|
35 | |||
36 | //! [3] |
|
36 | //! [3] | |
37 | // Create series and add sets to it |
|
37 | // Create series and add sets to it | |
38 |
QStackedBar |
|
38 | QStackedBarSeries* series = new QStackedBarSeries(category); | |
39 |
|
39 | |||
40 | series->addBarSet(set0); |
|
40 | series->addBarSet(set0); | |
41 | series->addBarSet(set1); |
|
41 | series->addBarSet(set1); |
@@ -9,10 +9,10 SOURCES += \ | |||||
9 | $$PWD/barpresenterbase.cpp \ |
|
9 | $$PWD/barpresenterbase.cpp \ | |
10 | $$PWD/percentbarpresenter.cpp \ |
|
10 | $$PWD/percentbarpresenter.cpp \ | |
11 | $$PWD/qbarcategory.cpp \ |
|
11 | $$PWD/qbarcategory.cpp \ | |
12 |
$$PWD/qbar |
|
12 | $$PWD/qbarseries.cpp \ | |
13 | $$PWD/qbarset.cpp \ |
|
13 | $$PWD/qbarset.cpp \ | |
14 |
$$PWD/qpercentbar |
|
14 | $$PWD/qpercentbarseries.cpp \ | |
15 |
$$PWD/qstackedbar |
|
15 | $$PWD/qstackedbarseries.cpp \ | |
16 | $$PWD/separator.cpp \ |
|
16 | $$PWD/separator.cpp \ | |
17 | $$PWD/stackedbarpresenter.cpp \ |
|
17 | $$PWD/stackedbarpresenter.cpp \ | |
18 | $$PWD/barvalue.cpp |
|
18 | $$PWD/barvalue.cpp | |
@@ -30,9 +30,9 PRIVATE_HEADERS += \ | |||||
30 |
|
30 | |||
31 | PUBLIC_HEADERS += \ |
|
31 | PUBLIC_HEADERS += \ | |
32 | $$PWD/qbarcategory.h \ |
|
32 | $$PWD/qbarcategory.h \ | |
33 |
$$PWD/qbar |
|
33 | $$PWD/qbarseries.h \ | |
34 | $$PWD/qbarset.h \ |
|
34 | $$PWD/qbarset.h \ | |
35 |
$$PWD/qpercentbar |
|
35 | $$PWD/qpercentbarseries.h \ | |
36 |
$$PWD/qstackedbar |
|
36 | $$PWD/qstackedbarseries.h | |
37 |
|
37 | |||
38 |
|
38 |
@@ -7,7 +7,7 | |||||
7 |
|
7 | |||
8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
9 |
|
9 | |||
10 |
BarPresenter::BarPresenter(QBar |
|
10 | BarPresenter::BarPresenter(QBarSeries *series, QGraphicsItem *parent) : | |
11 | BarPresenterBase(series, parent) |
|
11 | BarPresenterBase(series, parent) | |
12 | { |
|
12 | { | |
13 | mBarDefaultWidth = 15; |
|
13 | mBarDefaultWidth = 15; |
@@ -7,14 +7,14 | |||||
7 |
|
7 | |||
8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
9 |
|
9 | |||
10 |
class QBar |
|
10 | class QBarSeries; | |
11 |
|
11 | |||
12 | // Presenter for parallel bars. Grouping of bars is done on category basis. |
|
12 | // Presenter for parallel bars. Grouping of bars is done on category basis. | |
13 | class BarPresenter : public BarPresenterBase |
|
13 | class BarPresenter : public BarPresenterBase | |
14 | { |
|
14 | { | |
15 | Q_OBJECT |
|
15 | Q_OBJECT | |
16 | public: |
|
16 | public: | |
17 |
explicit BarPresenter(QBar |
|
17 | explicit BarPresenter(QBarSeries *series, QGraphicsItem *parent = 0); | |
18 |
|
18 | |||
19 | private: |
|
19 | private: | |
20 |
|
20 |
@@ -4,13 +4,13 | |||||
4 | #include "barlabel_p.h" |
|
4 | #include "barlabel_p.h" | |
5 | #include "separator_p.h" |
|
5 | #include "separator_p.h" | |
6 | #include "qbarset.h" |
|
6 | #include "qbarset.h" | |
7 |
#include "qbar |
|
7 | #include "qbarseries.h" | |
8 | #include <QDebug> |
|
8 | #include <QDebug> | |
9 | #include <QToolTip> |
|
9 | #include <QToolTip> | |
10 |
|
10 | |||
11 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
11 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
12 |
|
12 | |||
13 |
BarPresenterBase::BarPresenterBase(QBar |
|
13 | BarPresenterBase::BarPresenterBase(QBarSeries *series, QGraphicsItem *parent) | |
14 | : ChartItem(parent) |
|
14 | : ChartItem(parent) | |
15 | ,mBarDefaultWidth(20) // TODO: remove hard coding, when we have layout code ready |
|
15 | ,mBarDefaultWidth(20) // TODO: remove hard coding, when we have layout code ready | |
16 | ,mLayoutSet(false) |
|
16 | ,mLayoutSet(false) |
@@ -2,7 +2,7 | |||||
2 | #define BARPRESENTERBASE_H |
|
2 | #define BARPRESENTERBASE_H | |
3 |
|
3 | |||
4 | #include "chartitem_p.h" |
|
4 | #include "chartitem_p.h" | |
5 |
#include "qbar |
|
5 | #include "qbarseries.h" | |
6 | #include <QPen> |
|
6 | #include <QPen> | |
7 | #include <QBrush> |
|
7 | #include <QBrush> | |
8 | #include <QGraphicsItem> |
|
8 | #include <QGraphicsItem> | |
@@ -20,7 +20,7 class BarPresenterBase : public QObject, public ChartItem | |||||
20 | { |
|
20 | { | |
21 | Q_OBJECT |
|
21 | Q_OBJECT | |
22 | public: |
|
22 | public: | |
23 |
BarPresenterBase(QBar |
|
23 | BarPresenterBase(QBarSeries *series, QGraphicsItem *parent = 0); | |
24 | ~BarPresenterBase(); |
|
24 | ~BarPresenterBase(); | |
25 |
|
25 | |||
26 | public: |
|
26 | public: | |
@@ -57,7 +57,7 protected: | |||||
57 | bool mSeparatorsEnabled; |
|
57 | bool mSeparatorsEnabled; | |
58 |
|
58 | |||
59 | // Owned |
|
59 | // Owned | |
60 |
QBar |
|
60 | QBarSeries* mSeries; | |
61 |
|
61 | |||
62 | // Not owned. |
|
62 | // Not owned. | |
63 | QList<Bar*> mBars; |
|
63 | QList<Bar*> mBars; |
@@ -9,7 +9,7 | |||||
9 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
9 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
10 |
|
10 | |||
11 |
|
11 | |||
12 |
PercentBarPresenter::PercentBarPresenter(QBar |
|
12 | PercentBarPresenter::PercentBarPresenter(QBarSeries *series, QGraphicsItem *parent) : | |
13 | BarPresenterBase(series, parent) |
|
13 | BarPresenterBase(series, parent) | |
14 | { |
|
14 | { | |
15 | } |
|
15 | } |
@@ -3,7 +3,7 | |||||
3 |
|
3 | |||
4 | #include "chartitem_p.h" |
|
4 | #include "chartitem_p.h" | |
5 | #include "bar_p.h" |
|
5 | #include "bar_p.h" | |
6 |
#include "qpercentbar |
|
6 | #include "qpercentbarseries.h" | |
7 | #include "barpresenterbase.h" |
|
7 | #include "barpresenterbase.h" | |
8 | #include <QGraphicsItem> |
|
8 | #include <QGraphicsItem> | |
9 |
|
9 | |||
@@ -13,7 +13,7 class PercentBarPresenter : public BarPresenterBase | |||||
13 | { |
|
13 | { | |
14 | Q_OBJECT |
|
14 | Q_OBJECT | |
15 | public: |
|
15 | public: | |
16 |
PercentBarPresenter(QBar |
|
16 | PercentBarPresenter(QBarSeries *series, QGraphicsItem *parent = 0); | |
17 |
|
17 | |||
18 | private: |
|
18 | private: | |
19 |
|
19 |
@@ -16,7 +16,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
16 | Example on how to create a category: |
|
16 | Example on how to create a category: | |
17 | \snippet ../example/barchart/main.cpp 1 |
|
17 | \snippet ../example/barchart/main.cpp 1 | |
18 |
|
18 | |||
19 |
\sa QBar |
|
19 | \sa QBarSeries, QStackedBarSeries, QPercentBarSeries | |
20 | */ |
|
20 | */ | |
21 |
|
21 | |||
22 | /*! |
|
22 | /*! |
@@ -1,5 +1,5 | |||||
1 | #include <QDebug> |
|
1 | #include <QDebug> | |
2 |
#include "qbar |
|
2 | #include "qbarseries.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" | |
@@ -8,11 +8,11 | |||||
8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
9 |
|
9 | |||
10 | /*! |
|
10 | /*! | |
11 |
\class QBar |
|
11 | \class QBarSeries | |
12 | \brief part of QtCommercial chart API. |
|
12 | \brief part of QtCommercial chart API. | |
13 |
|
13 | |||
14 |
QBar |
|
14 | QBarSeries represents a series of data shown as bars. One QBarSeries can contain multible | |
15 |
QBarSet data sets. QBar |
|
15 | QBarSet data sets. QBarSeries groups the data from sets to categories, which are defined | |
16 | by QBarCategory class. |
|
16 | by QBarCategory class. | |
17 |
|
17 | |||
18 | \mainclass |
|
18 | \mainclass | |
@@ -32,41 +32,41 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
32 | Example on how to create view and apply theme: |
|
32 | Example on how to create view and apply theme: | |
33 | \snippet ../example/barchart/main.cpp 5 |
|
33 | \snippet ../example/barchart/main.cpp 5 | |
34 |
|
34 | |||
35 |
\sa QBarCategory, QBarSet, QStackedBar |
|
35 | \sa QBarCategory, QBarSet, QStackedBarSeries, QPercentBarSeries | |
36 | */ |
|
36 | */ | |
37 |
|
37 | |||
38 | /*! |
|
38 | /*! | |
39 |
\fn virtual QChartSeriesType QBar |
|
39 | \fn virtual QChartSeriesType QBarSeries::type() const | |
40 | \brief Returns type of series. |
|
40 | \brief Returns type of series. | |
41 | \sa QChartSeries, QChartSeriesType |
|
41 | \sa QChartSeries, QChartSeriesType | |
42 | */ |
|
42 | */ | |
43 | /*! |
|
43 | /*! | |
44 |
\fn void QBar |
|
44 | \fn void QBarSeries::changed(int index) | |
45 | \brief \internal \a index |
|
45 | \brief \internal \a index | |
46 | */ |
|
46 | */ | |
47 | /*! |
|
47 | /*! | |
48 |
\fn void QBar |
|
48 | \fn void QBarSeries::floatingValuesEnabled(bool enabled) | |
49 | \brief \internal \a enabled |
|
49 | \brief \internal \a enabled | |
50 | */ |
|
50 | */ | |
51 | /*! |
|
51 | /*! | |
52 |
\fn void QBar |
|
52 | \fn void QBarSeries::toolTipEnabled(bool enabled) | |
53 | \brief \internal \a enabled |
|
53 | \brief \internal \a enabled | |
54 | */ |
|
54 | */ | |
55 | /*! |
|
55 | /*! | |
56 |
\fn void QBar |
|
56 | \fn void QBarSeries::separatorsEnabled(bool enabled) | |
57 | \brief \internal \a enabled |
|
57 | \brief \internal \a enabled | |
58 | */ |
|
58 | */ | |
59 | /*! |
|
59 | /*! | |
60 |
\fn void QBar |
|
60 | \fn void QBarSeries::showToolTip(QPoint pos, QString tip) | |
61 | \brief \internal \a pos \a tip |
|
61 | \brief \internal \a pos \a tip | |
62 | */ |
|
62 | */ | |
63 |
|
63 | |||
64 | /*! |
|
64 | /*! | |
65 |
Constructs empty QBar |
|
65 | Constructs empty QBarSeries. Parameter \a category defines the categories for chart. | |
66 | Takes ownership of \a category. |
|
66 | Takes ownership of \a category. | |
67 |
QBar |
|
67 | QBarSeries is QObject which is a child of a \a parent. | |
68 | */ |
|
68 | */ | |
69 |
QBar |
|
69 | QBarSeries::QBarSeries(QBarCategory *category, QObject *parent) | |
70 | : QChartSeries(parent) |
|
70 | : QChartSeries(parent) | |
71 | ,mModel(new BarChartModel(category, this)) |
|
71 | ,mModel(new BarChartModel(category, this)) | |
72 | { |
|
72 | { | |
@@ -75,7 +75,7 QBarChartSeries::QBarChartSeries(QBarCategory *category, QObject *parent) | |||||
75 | /*! |
|
75 | /*! | |
76 | Adds a set of bars to series. Takes ownership of \a set |
|
76 | Adds a set of bars to series. Takes ownership of \a set | |
77 | */ |
|
77 | */ | |
78 |
void QBar |
|
78 | void QBarSeries::addBarSet(QBarSet *set) | |
79 | { |
|
79 | { | |
80 | mModel->addBarSet(set); |
|
80 | mModel->addBarSet(set); | |
81 | } |
|
81 | } | |
@@ -83,7 +83,7 void QBarChartSeries::addBarSet(QBarSet *set) | |||||
83 | /*! |
|
83 | /*! | |
84 | Removes a set of bars from series. Releases ownership of \a set. Doesnt delete \a set. |
|
84 | Removes a set of bars from series. Releases ownership of \a set. Doesnt delete \a set. | |
85 | */ |
|
85 | */ | |
86 |
void QBar |
|
86 | void QBarSeries::removeBarSet(QBarSet *set) | |
87 | { |
|
87 | { | |
88 | mModel->removeBarSet(set); |
|
88 | mModel->removeBarSet(set); | |
89 | } |
|
89 | } | |
@@ -91,7 +91,7 void QBarChartSeries::removeBarSet(QBarSet *set) | |||||
91 | /*! |
|
91 | /*! | |
92 | Returns number of sets in series. |
|
92 | Returns number of sets in series. | |
93 | */ |
|
93 | */ | |
94 |
int QBar |
|
94 | int QBarSeries::countSets() | |
95 | { |
|
95 | { | |
96 | return mModel->countSets(); |
|
96 | return mModel->countSets(); | |
97 | } |
|
97 | } | |
@@ -99,7 +99,7 int QBarChartSeries::countSets() | |||||
99 | /*! |
|
99 | /*! | |
100 | Returns number of categories in series |
|
100 | Returns number of categories in series | |
101 | */ |
|
101 | */ | |
102 |
int QBar |
|
102 | int QBarSeries::countCategories() | |
103 | { |
|
103 | { | |
104 | return mModel->countCategories(); |
|
104 | return mModel->countCategories(); | |
105 | } |
|
105 | } | |
@@ -110,7 +110,7 int QBarChartSeries::countCategories() | |||||
110 | If series is empty, returns 0. |
|
110 | If series is empty, returns 0. | |
111 | Returns 0 after last set. |
|
111 | Returns 0 after last set. | |
112 | */ |
|
112 | */ | |
113 |
QBarSet* QBar |
|
113 | QBarSet* QBarSeries::nextSet(bool getFirst) | |
114 | { |
|
114 | { | |
115 | return mModel->nextSet(getFirst); |
|
115 | return mModel->nextSet(getFirst); | |
116 | } |
|
116 | } | |
@@ -120,7 +120,7 QBarSet* QBarChartSeries::nextSet(bool getFirst) | |||||
120 | Assumes that \a index is between 0 and number of sets. Use countSets() to get valid index bound. |
|
120 | Assumes that \a index is between 0 and number of sets. Use countSets() to get valid index bound. | |
121 | \sa countSets() |
|
121 | \sa countSets() | |
122 | */ |
|
122 | */ | |
123 |
QBarSet* QBar |
|
123 | QBarSet* QBarSeries::setAt(int index) | |
124 | { |
|
124 | { | |
125 | return mModel->setAt(index); |
|
125 | return mModel->setAt(index); | |
126 | } |
|
126 | } | |
@@ -128,7 +128,7 QBarSet* QBarChartSeries::setAt(int index) | |||||
128 | /*! |
|
128 | /*! | |
129 | Returns legend of series. Legend is a list of set names in series. |
|
129 | Returns legend of series. Legend is a list of set names in series. | |
130 | */ |
|
130 | */ | |
131 |
QList<QString> QBar |
|
131 | QList<QString> QBarSeries::legend() | |
132 | { |
|
132 | { | |
133 | return mModel->legend(); |
|
133 | return mModel->legend(); | |
134 | } |
|
134 | } | |
@@ -136,7 +136,7 QList<QString> QBarChartSeries::legend() | |||||
136 | /*! |
|
136 | /*! | |
137 | \internal \a category |
|
137 | \internal \a category | |
138 | */ |
|
138 | */ | |
139 |
QString QBar |
|
139 | QString QBarSeries::label(int category) | |
140 | { |
|
140 | { | |
141 | return mModel->label(category); |
|
141 | return mModel->label(category); | |
142 | } |
|
142 | } | |
@@ -146,7 +146,7 QString QBarChartSeries::label(int category) | |||||
146 | Floating values are bar values, that are displayed on top of each bar. |
|
146 | Floating values are bar values, that are displayed on top of each bar. | |
147 | Calling without parameter \a enabled, enables the floating values |
|
147 | Calling without parameter \a enabled, enables the floating values | |
148 | */ |
|
148 | */ | |
149 |
void QBar |
|
149 | void QBarSeries::enableFloatingValues(bool enabled) | |
150 | { |
|
150 | { | |
151 | if (enabled) { |
|
151 | if (enabled) { | |
152 | for (int i=0; i<mModel->countSets(); i++) { |
|
152 | for (int i=0; i<mModel->countSets(); i++) { | |
@@ -166,7 +166,7 void QBarChartSeries::enableFloatingValues(bool enabled) | |||||
166 | Tooltip shows the name of set, when mouse is hovering on top of bar. |
|
166 | Tooltip shows the name of set, when mouse is hovering on top of bar. | |
167 | Calling without parameter \a enabled, enables the tooltip |
|
167 | Calling without parameter \a enabled, enables the tooltip | |
168 | */ |
|
168 | */ | |
169 |
void QBar |
|
169 | void QBarSeries::enableToolTip(bool enabled) | |
170 | { |
|
170 | { | |
171 | if (enabled) { |
|
171 | if (enabled) { | |
172 | for (int i=0; i<mModel->countSets(); i++) { |
|
172 | for (int i=0; i<mModel->countSets(); i++) { | |
@@ -186,7 +186,7 void QBarChartSeries::enableToolTip(bool enabled) | |||||
186 | Separators are visual elements that are drawn between categories. |
|
186 | Separators are visual elements that are drawn between categories. | |
187 | Calling without parameter \a enabled, enables the separators |
|
187 | Calling without parameter \a enabled, enables the separators | |
188 | */ |
|
188 | */ | |
189 |
void QBar |
|
189 | void QBarSeries::enableSeparators(bool enabled) | |
190 | { |
|
190 | { | |
191 | emit separatorsEnabled(enabled); |
|
191 | emit separatorsEnabled(enabled); | |
192 | } |
|
192 | } | |
@@ -194,7 +194,7 void QBarChartSeries::enableSeparators(bool enabled) | |||||
194 | /*! |
|
194 | /*! | |
195 | \internal |
|
195 | \internal | |
196 | */ |
|
196 | */ | |
197 |
qreal QBar |
|
197 | qreal QBarSeries::min() | |
198 | { |
|
198 | { | |
199 | return mModel->min(); |
|
199 | return mModel->min(); | |
200 | } |
|
200 | } | |
@@ -202,7 +202,7 qreal QBarChartSeries::min() | |||||
202 | /*! |
|
202 | /*! | |
203 | \internal |
|
203 | \internal | |
204 | */ |
|
204 | */ | |
205 |
qreal QBar |
|
205 | qreal QBarSeries::max() | |
206 | { |
|
206 | { | |
207 | return mModel->max(); |
|
207 | return mModel->max(); | |
208 | } |
|
208 | } | |
@@ -210,7 +210,7 qreal QBarChartSeries::max() | |||||
210 | /*! |
|
210 | /*! | |
211 | \internal \a set \a category |
|
211 | \internal \a set \a category | |
212 | */ |
|
212 | */ | |
213 |
qreal QBar |
|
213 | qreal QBarSeries::valueAt(int set, int category) | |
214 | { |
|
214 | { | |
215 | return mModel->valueAt(set,category); |
|
215 | return mModel->valueAt(set,category); | |
216 | } |
|
216 | } | |
@@ -218,7 +218,7 qreal QBarChartSeries::valueAt(int set, int category) | |||||
218 | /*! |
|
218 | /*! | |
219 | \internal \a set \a category |
|
219 | \internal \a set \a category | |
220 | */ |
|
220 | */ | |
221 |
qreal QBar |
|
221 | qreal QBarSeries::percentageAt(int set, int category) | |
222 | { |
|
222 | { | |
223 | return mModel->percentageAt(set,category); |
|
223 | return mModel->percentageAt(set,category); | |
224 | } |
|
224 | } | |
@@ -226,7 +226,7 qreal QBarChartSeries::percentageAt(int set, int category) | |||||
226 | /*! |
|
226 | /*! | |
227 | \internal \a category |
|
227 | \internal \a category | |
228 | */ |
|
228 | */ | |
229 |
qreal QBar |
|
229 | qreal QBarSeries::categorySum(int category) | |
230 | { |
|
230 | { | |
231 | return mModel->categorySum(category); |
|
231 | return mModel->categorySum(category); | |
232 | } |
|
232 | } | |
@@ -234,7 +234,7 qreal QBarChartSeries::categorySum(int category) | |||||
234 | /*! |
|
234 | /*! | |
235 | \internal |
|
235 | \internal | |
236 | */ |
|
236 | */ | |
237 |
qreal QBar |
|
237 | qreal QBarSeries::maxCategorySum() | |
238 | { |
|
238 | { | |
239 | return mModel->maxCategorySum(); |
|
239 | return mModel->maxCategorySum(); | |
240 | } |
|
240 | } | |
@@ -242,11 +242,11 qreal QBarChartSeries::maxCategorySum() | |||||
242 | /*! |
|
242 | /*! | |
243 | \internal |
|
243 | \internal | |
244 | */ |
|
244 | */ | |
245 |
BarChartModel& QBar |
|
245 | BarChartModel& QBarSeries::model() | |
246 | { |
|
246 | { | |
247 | return *mModel; |
|
247 | return *mModel; | |
248 | } |
|
248 | } | |
249 |
|
249 | |||
250 |
#include "moc_qbar |
|
250 | #include "moc_qbarseries.cpp" | |
251 |
|
251 | |||
252 | QTCOMMERCIALCHART_END_NAMESPACE |
|
252 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,5 +1,5 | |||||
1 |
#ifndef BAR |
|
1 | #ifndef BARSERIES_H | |
2 |
#define BAR |
|
2 | #define BARSERIES_H | |
3 |
|
3 | |||
4 | #include "qchartseries.h" |
|
4 | #include "qchartseries.h" | |
5 |
|
5 | |||
@@ -10,11 +10,11 class QBarSet; | |||||
10 | class BarChartModel; |
|
10 | class BarChartModel; | |
11 |
|
11 | |||
12 | // Container for series |
|
12 | // Container for series | |
13 |
class QTCOMMERCIALCHART_EXPORT QBar |
|
13 | class QTCOMMERCIALCHART_EXPORT QBarSeries : public QChartSeries | |
14 | { |
|
14 | { | |
15 | Q_OBJECT |
|
15 | Q_OBJECT | |
16 | public: |
|
16 | public: | |
17 |
QBar |
|
17 | QBarSeries(QBarCategory *category, QObject* parent=0); | |
18 |
|
18 | |||
19 | virtual QChartSeriesType type() const { return QChartSeries::SeriesTypeBar; } |
|
19 | virtual QChartSeriesType type() const { return QChartSeries::SeriesTypeBar; } | |
20 |
|
20 | |||
@@ -63,4 +63,4 protected: | |||||
63 |
|
63 | |||
64 | QTCOMMERCIALCHART_END_NAMESPACE |
|
64 | QTCOMMERCIALCHART_END_NAMESPACE | |
65 |
|
65 | |||
66 |
#endif // BAR |
|
66 | #endif // BARSERIES_H |
@@ -18,7 +18,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
18 | Example on how to create sets of data: |
|
18 | Example on how to create sets of data: | |
19 | \snippet ../example/barchart/main.cpp 2 |
|
19 | \snippet ../example/barchart/main.cpp 2 | |
20 |
|
20 | |||
21 |
\sa QBarCategory, QBar |
|
21 | \sa QBarCategory, QBarSeries, QStackedBarSeries, QPercentBarSeries | |
22 | */ |
|
22 | */ | |
23 |
|
23 | |||
24 | /*! |
|
24 | /*! |
@@ -1,14 +1,14 | |||||
1 |
#include "q |
|
1 | #include "qpercentbarseries.h" | |
2 |
|
2 | |||
3 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
3 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
4 |
|
4 | |||
5 | /*! |
|
5 | /*! | |
6 |
\class Q |
|
6 | \class QPercentBarSeries | |
7 | \brief part of QtCommercial chart API. |
|
7 | \brief part of QtCommercial chart API. | |
8 |
|
8 | |||
9 |
Q |
|
9 | QPercentBarSeries represents a series of data shown as bars. Each bar of QBarSet is shown as percentage | |
10 |
|
|
10 | of all bars in category. One QPercentBarSeries can contain multible QBarSet data sets. | |
11 |
Q |
|
11 | QBarSeries groups the data from sets to categories, which are defined by QBarCategory class. | |
12 |
|
12 | |||
13 | \mainclass |
|
13 | \mainclass | |
14 |
|
14 | |||
@@ -27,25 +27,25 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
27 | Example on how to create view and apply theme: |
|
27 | Example on how to create view and apply theme: | |
28 | \snippet ../example/barchart/main.cpp 5 |
|
28 | \snippet ../example/barchart/main.cpp 5 | |
29 |
|
29 | |||
30 |
\sa QBarCategory, QBarSet, Q |
|
30 | \sa QBarCategory, QBarSet, QStackedBarSeries, QBarSeries | |
31 | */ |
|
31 | */ | |
32 |
|
32 | |||
33 | /*! |
|
33 | /*! | |
34 |
\fn virtual QChartSeriesType Q |
|
34 | \fn virtual QChartSeriesType QPercentBarSeries::type() const | |
35 | \brief Returns type of series. |
|
35 | \brief Returns type of series. | |
36 | \sa QChartSeries, QChartSeriesType |
|
36 | \sa QChartSeries, QChartSeriesType | |
37 | */ |
|
37 | */ | |
38 |
|
38 | |||
39 | /*! |
|
39 | /*! | |
40 |
Constructs empty Q |
|
40 | Constructs empty QPercentBarSeries. Parameter \a category defines the categories for chart. | |
41 |
Q |
|
41 | QPercentBarSeries is QObject which is a child of a \a parent. | |
42 | */ |
|
42 | */ | |
43 |
Q |
|
43 | QPercentBarSeries::QPercentBarSeries(QBarCategory *category, QObject *parent) | |
44 |
: QBar |
|
44 | : QBarSeries(category, parent) | |
45 | { |
|
45 | { | |
46 | } |
|
46 | } | |
47 |
|
47 | |||
48 |
#include "moc_q |
|
48 | #include "moc_qpercentbarseries.cpp" | |
49 |
|
49 | |||
50 | QTCOMMERCIALCHART_END_NAMESPACE |
|
50 | QTCOMMERCIALCHART_END_NAMESPACE | |
51 |
|
51 |
@@ -1,15 +1,15 | |||||
1 |
#ifndef PERCENTBAR |
|
1 | #ifndef PERCENTBARSERIES_H | |
2 |
#define PERCENTBAR |
|
2 | #define PERCENTBARSERIES_H | |
3 |
|
3 | |||
4 |
#include "qbar |
|
4 | #include "qbarseries.h" | |
5 |
|
5 | |||
6 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
6 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
7 |
|
7 | |||
8 |
class QTCOMMERCIALCHART_EXPORT QPercentBar |
|
8 | class QTCOMMERCIALCHART_EXPORT QPercentBarSeries : public QBarSeries | |
9 | { |
|
9 | { | |
10 | Q_OBJECT |
|
10 | Q_OBJECT | |
11 | public: |
|
11 | public: | |
12 |
QPercentBar |
|
12 | QPercentBarSeries(QBarCategory *category, QObject* parent=0); | |
13 |
|
13 | |||
14 | virtual QChartSeriesType type() const { return QChartSeries::SeriesTypePercentBar; } |
|
14 | virtual QChartSeriesType type() const { return QChartSeries::SeriesTypePercentBar; } | |
15 | }; |
|
15 | }; | |
@@ -17,4 +17,4 public: | |||||
17 | QTCOMMERCIALCHART_END_NAMESPACE |
|
17 | QTCOMMERCIALCHART_END_NAMESPACE | |
18 |
|
18 | |||
19 |
|
19 | |||
20 |
#endif // PERCENTBAR |
|
20 | #endif // PERCENTBARSERIES_H |
@@ -1,14 +1,14 | |||||
1 |
#include "q |
|
1 | #include "qstackedbarseries.h" | |
2 |
|
2 | |||
3 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
3 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
4 |
|
4 | |||
5 | /*! |
|
5 | /*! | |
6 |
\class Q |
|
6 | \class QStackedBarSeries | |
7 | \brief part of QtCommercial chart API. |
|
7 | \brief part of QtCommercial chart API. | |
8 |
|
8 | |||
9 |
Q |
|
9 | QStackedBarSeries represents a series of data shown as bars. All bars in same category are | |
10 |
|
|
10 | stacked on top of each other. One QStackedBarSeries can contain multible QBarSet data sets. | |
11 |
Q |
|
11 | QStackedBarSeries groups the data from sets to categories, which are defined by QBarCategory class. | |
12 |
|
12 | |||
13 | \mainclass |
|
13 | \mainclass | |
14 |
|
14 | |||
@@ -27,25 +27,25 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
27 | Example on how to create view and apply theme: |
|
27 | Example on how to create view and apply theme: | |
28 | \snippet ../example/barchart/main.cpp 5 |
|
28 | \snippet ../example/barchart/main.cpp 5 | |
29 |
|
29 | |||
30 |
\sa QBarCategory, QBarSet, Q |
|
30 | \sa QBarCategory, QBarSet, QPercentBarSeries, QBarSeries | |
31 | */ |
|
31 | */ | |
32 |
|
32 | |||
33 | /*! |
|
33 | /*! | |
34 |
\fn virtual QChartSeriesType Q |
|
34 | \fn virtual QChartSeriesType QStackedBarSeries::type() const | |
35 | \brief Returns type of series. |
|
35 | \brief Returns type of series. | |
36 | \sa QChartSeries, QChartSeriesType |
|
36 | \sa QChartSeries, QChartSeriesType | |
37 | */ |
|
37 | */ | |
38 |
|
38 | |||
39 | /*! |
|
39 | /*! | |
40 |
Constructs empty Q |
|
40 | Constructs empty QStackedBarSeries. Parameter \a category defines the categories for chart. | |
41 |
Q |
|
41 | QStackedBarSeries is QObject which is a child of a \a parent. | |
42 | */ |
|
42 | */ | |
43 |
Q |
|
43 | QStackedBarSeries::QStackedBarSeries(QBarCategory *category, QObject *parent) | |
44 |
: QBar |
|
44 | : QBarSeries(category, parent) | |
45 | { |
|
45 | { | |
46 | } |
|
46 | } | |
47 |
|
47 | |||
48 |
#include "moc_q |
|
48 | #include "moc_qstackedbarseries.cpp" | |
49 |
|
49 | |||
50 | QTCOMMERCIALCHART_END_NAMESPACE |
|
50 | QTCOMMERCIALCHART_END_NAMESPACE | |
51 |
|
51 |
@@ -1,21 +1,21 | |||||
1 |
#ifndef STACKEDBAR |
|
1 | #ifndef STACKEDBARSERIES_H | |
2 |
#define STACKEDBAR |
|
2 | #define STACKEDBARSERIES_H | |
3 |
|
3 | |||
4 |
#include "qbar |
|
4 | #include "qbarseries.h" | |
5 |
|
5 | |||
6 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
6 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
7 |
|
7 | |||
8 | class QBarCategory; |
|
8 | class QBarCategory; | |
9 |
|
9 | |||
10 |
class QTCOMMERCIALCHART_EXPORT QStackedBar |
|
10 | class QTCOMMERCIALCHART_EXPORT QStackedBarSeries : public QBarSeries | |
11 | { |
|
11 | { | |
12 | Q_OBJECT |
|
12 | Q_OBJECT | |
13 | public: |
|
13 | public: | |
14 |
QStackedBar |
|
14 | QStackedBarSeries(QBarCategory *category, QObject* parent=0); | |
15 |
|
15 | |||
16 | virtual QChartSeriesType type() const { return QChartSeries::SeriesTypeStackedBar; } |
|
16 | virtual QChartSeriesType type() const { return QChartSeries::SeriesTypeStackedBar; } | |
17 | }; |
|
17 | }; | |
18 |
|
18 | |||
19 | QTCOMMERCIALCHART_END_NAMESPACE |
|
19 | QTCOMMERCIALCHART_END_NAMESPACE | |
20 |
|
20 | |||
21 |
#endif // STACKEDBAR |
|
21 | #endif // STACKEDBARSERIES_H |
@@ -8,7 +8,7 | |||||
8 |
|
8 | |||
9 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
9 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
10 |
|
10 | |||
11 |
StackedBarPresenter::StackedBarPresenter(QBar |
|
11 | StackedBarPresenter::StackedBarPresenter(QBarSeries *series, QGraphicsItem *parent) : | |
12 | BarPresenterBase(series,parent) |
|
12 | BarPresenterBase(series,parent) | |
13 | { |
|
13 | { | |
14 | } |
|
14 | } |
@@ -2,7 +2,7 | |||||
2 | #define STACKEDBARPRESENTER_H |
|
2 | #define STACKEDBARPRESENTER_H | |
3 |
|
3 | |||
4 | #include "barpresenterbase.h" |
|
4 | #include "barpresenterbase.h" | |
5 |
#include "qstackedbar |
|
5 | #include "qstackedbarseries.h" | |
6 | #include <QGraphicsItem> |
|
6 | #include <QGraphicsItem> | |
7 |
|
7 | |||
8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
@@ -11,7 +11,7 class StackedBarPresenter : public BarPresenterBase | |||||
11 | { |
|
11 | { | |
12 | Q_OBJECT |
|
12 | Q_OBJECT | |
13 | public: |
|
13 | public: | |
14 |
StackedBarPresenter(QBar |
|
14 | StackedBarPresenter(QBarSeries *series, QGraphicsItem *parent = 0); | |
15 |
|
15 | |||
16 | private: |
|
16 | private: | |
17 | // From BarPresenterBase |
|
17 | // From BarPresenterBase |
@@ -2,9 +2,9 | |||||
2 | #include "qchartaxis.h" |
|
2 | #include "qchartaxis.h" | |
3 | //series |
|
3 | //series | |
4 | #include "qlinechartseries.h" |
|
4 | #include "qlinechartseries.h" | |
5 |
#include "qbar |
|
5 | #include "qbarseries.h" | |
6 |
#include "qstackedbar |
|
6 | #include "qstackedbarseries.h" | |
7 |
#include "qpercentbar |
|
7 | #include "qpercentbarseries.h" | |
8 | #include "qpieseries.h" |
|
8 | #include "qpieseries.h" | |
9 | #include "qscatterseries.h" |
|
9 | #include "qscatterseries.h" | |
10 |
|
10 | |||
@@ -72,7 +72,7 void ChartDataSet::addSeries(QChartSeries* series, QChartAxis *axisY) | |||||
72 | } |
|
72 | } | |
73 | case QChartSeries::SeriesTypeBar: { |
|
73 | case QChartSeries::SeriesTypeBar: { | |
74 | qDebug() << "QChartSeries::SeriesTypeBar"; |
|
74 | qDebug() << "QChartSeries::SeriesTypeBar"; | |
75 |
QBar |
|
75 | QBarSeries* barSeries = static_cast<QBarSeries*>(series); | |
76 | qreal x = barSeries->countCategories(); |
|
76 | qreal x = barSeries->countCategories(); | |
77 | qreal y = barSeries->max(); |
|
77 | qreal y = barSeries->max(); | |
78 | domain.m_minX = qMin(domain.m_minX,x); |
|
78 | domain.m_minX = qMin(domain.m_minX,x); | |
@@ -84,7 +84,7 void ChartDataSet::addSeries(QChartSeries* series, QChartAxis *axisY) | |||||
84 | case QChartSeries::SeriesTypeStackedBar: { |
|
84 | case QChartSeries::SeriesTypeStackedBar: { | |
85 | qDebug() << "QChartSeries::SeriesTypeStackedBar"; |
|
85 | qDebug() << "QChartSeries::SeriesTypeStackedBar"; | |
86 |
|
86 | |||
87 |
QStackedBar |
|
87 | QStackedBarSeries* stackedBarSeries = static_cast<QStackedBarSeries*>(series); | |
88 | qreal x = stackedBarSeries->countCategories(); |
|
88 | qreal x = stackedBarSeries->countCategories(); | |
89 | qreal y = stackedBarSeries->maxCategorySum(); |
|
89 | qreal y = stackedBarSeries->maxCategorySum(); | |
90 | domain.m_minX = qMin(domain.m_minX,x); |
|
90 | domain.m_minX = qMin(domain.m_minX,x); | |
@@ -96,7 +96,7 void ChartDataSet::addSeries(QChartSeries* series, QChartAxis *axisY) | |||||
96 | case QChartSeries::SeriesTypePercentBar: { |
|
96 | case QChartSeries::SeriesTypePercentBar: { | |
97 | qDebug() << "QChartSeries::SeriesTypePercentBar"; |
|
97 | qDebug() << "QChartSeries::SeriesTypePercentBar"; | |
98 |
|
98 | |||
99 |
QPercentBar |
|
99 | QPercentBarSeries* percentBarSeries = static_cast<QPercentBarSeries*>(series); | |
100 | qreal x = percentBarSeries->countCategories(); |
|
100 | qreal x = percentBarSeries->countCategories(); | |
101 | domain.m_minX = qMin(domain.m_minX,x); |
|
101 | domain.m_minX = qMin(domain.m_minX,x); | |
102 | domain.m_minY = 0; |
|
102 | domain.m_minY = 0; |
@@ -4,9 +4,9 | |||||
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 "qbar |
|
7 | #include "qbarseries.h" | |
8 |
#include "qstackedbar |
|
8 | #include "qstackedbarseries.h" | |
9 |
#include "qpercentbar |
|
9 | #include "qpercentbarseries.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" | |
@@ -124,7 +124,7 void ChartPresenter::handleSeriesAdded(QChartSeries* series) | |||||
124 | } |
|
124 | } | |
125 |
|
125 | |||
126 | case QChartSeries::SeriesTypeBar: { |
|
126 | case QChartSeries::SeriesTypeBar: { | |
127 |
QBar |
|
127 | QBarSeries* barSeries = static_cast<QBarSeries*>(series); | |
128 | BarPresenter* item = new BarPresenter(barSeries,m_chart); |
|
128 | BarPresenter* item = new BarPresenter(barSeries,m_chart); | |
129 | m_chartTheme->decorate(item,barSeries,m_chartItems.count()); |
|
129 | m_chartTheme->decorate(item,barSeries,m_chartItems.count()); | |
130 | QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),item,SLOT(handleGeometryChanged(const QRectF&))); |
|
130 | QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),item,SLOT(handleGeometryChanged(const QRectF&))); | |
@@ -136,7 +136,7 void ChartPresenter::handleSeriesAdded(QChartSeries* series) | |||||
136 |
|
136 | |||
137 | case QChartSeries::SeriesTypeStackedBar: { |
|
137 | case QChartSeries::SeriesTypeStackedBar: { | |
138 |
|
138 | |||
139 |
QStackedBar |
|
139 | QStackedBarSeries* stackedBarSeries = static_cast<QStackedBarSeries*>(series); | |
140 | StackedBarPresenter* item = new StackedBarPresenter(stackedBarSeries,m_chart); |
|
140 | StackedBarPresenter* item = new StackedBarPresenter(stackedBarSeries,m_chart); | |
141 | m_chartTheme->decorate(item,stackedBarSeries,m_chartItems.count()); |
|
141 | m_chartTheme->decorate(item,stackedBarSeries,m_chartItems.count()); | |
142 | QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),item,SLOT(handleGeometryChanged(const QRectF&))); |
|
142 | QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),item,SLOT(handleGeometryChanged(const QRectF&))); | |
@@ -147,7 +147,7 void ChartPresenter::handleSeriesAdded(QChartSeries* series) | |||||
147 |
|
147 | |||
148 | case QChartSeries::SeriesTypePercentBar: { |
|
148 | case QChartSeries::SeriesTypePercentBar: { | |
149 |
|
149 | |||
150 |
QPercentBar |
|
150 | QPercentBarSeries* percentBarSeries = static_cast<QPercentBarSeries*>(series); | |
151 | PercentBarPresenter* item = new PercentBarPresenter(percentBarSeries,m_chart); |
|
151 | PercentBarPresenter* item = new PercentBarPresenter(percentBarSeries,m_chart); | |
152 | m_chartTheme->decorate(item,percentBarSeries ,m_chartItems.count()); |
|
152 | m_chartTheme->decorate(item,percentBarSeries ,m_chartItems.count()); | |
153 | QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),item,SLOT(handleGeometryChanged(const QRectF&))); |
|
153 | QObject::connect(this,SIGNAL(geometryChanged(const QRectF&)),item,SLOT(handleGeometryChanged(const QRectF&))); |
@@ -5,9 +5,9 | |||||
5 |
|
5 | |||
6 | //series |
|
6 | //series | |
7 | #include "qbarset.h" |
|
7 | #include "qbarset.h" | |
8 |
#include "qbar |
|
8 | #include "qbarseries.h" | |
9 |
#include "qstackedbar |
|
9 | #include "qstackedbarseries.h" | |
10 |
#include "qpercentbar |
|
10 | #include "qpercentbarseries.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" | |
@@ -91,19 +91,19 void ChartTheme::decorate(ChartItem* item, QChartSeries* series,int count) | |||||
91 | break; |
|
91 | break; | |
92 | } |
|
92 | } | |
93 | case QChartSeries::SeriesTypeBar: { |
|
93 | case QChartSeries::SeriesTypeBar: { | |
94 |
QBar |
|
94 | QBarSeries* b = static_cast<QBarSeries*>(series); | |
95 | BarPresenter* i = static_cast<BarPresenter*>(item); |
|
95 | BarPresenter* i = static_cast<BarPresenter*>(item); | |
96 | decorate(i,b,count); |
|
96 | decorate(i,b,count); | |
97 | break; |
|
97 | break; | |
98 | } |
|
98 | } | |
99 | case QChartSeries::SeriesTypeStackedBar: { |
|
99 | case QChartSeries::SeriesTypeStackedBar: { | |
100 |
QStackedBar |
|
100 | QStackedBarSeries* s = static_cast<QStackedBarSeries*>(series); | |
101 | StackedBarPresenter* i = static_cast<StackedBarPresenter*>(item); |
|
101 | StackedBarPresenter* i = static_cast<StackedBarPresenter*>(item); | |
102 | decorate(i,s,count); |
|
102 | decorate(i,s,count); | |
103 | break; |
|
103 | break; | |
104 | } |
|
104 | } | |
105 | case QChartSeries::SeriesTypePercentBar: { |
|
105 | case QChartSeries::SeriesTypePercentBar: { | |
106 |
QPercentBar |
|
106 | QPercentBarSeries* s = static_cast<QPercentBarSeries*>(series); | |
107 | PercentBarPresenter* i = static_cast<PercentBarPresenter*>(item); |
|
107 | PercentBarPresenter* i = static_cast<PercentBarPresenter*>(item); | |
108 | decorate(i,s,count); |
|
108 | decorate(i,s,count); | |
109 | break; |
|
109 | break; | |
@@ -141,21 +141,21 void ChartTheme::decorate(LineChartItem* item, QLineChartSeries* series,int coun | |||||
141 | item->setPen(pen); |
|
141 | item->setPen(pen); | |
142 | } |
|
142 | } | |
143 |
|
143 | |||
144 |
void ChartTheme::decorate(BarPresenter* item, QBar |
|
144 | void ChartTheme::decorate(BarPresenter* item, QBarSeries* series,int count) | |
145 | { |
|
145 | { | |
146 | for (int i=0; i<series->countSets(); i++) { |
|
146 | for (int i=0; i<series->countSets(); i++) { | |
147 | series->nextSet(0==i)->setBrush(QBrush(m_seriesColor.at(i%m_seriesColor.count()))); |
|
147 | series->nextSet(0==i)->setBrush(QBrush(m_seriesColor.at(i%m_seriesColor.count()))); | |
148 | } |
|
148 | } | |
149 | } |
|
149 | } | |
150 |
|
150 | |||
151 |
void ChartTheme::decorate(StackedBarPresenter* item, QStackedBar |
|
151 | void ChartTheme::decorate(StackedBarPresenter* item, QStackedBarSeries* series,int count) | |
152 | { |
|
152 | { | |
153 | for (int i=0; i<series->countSets(); i++) { |
|
153 | for (int i=0; i<series->countSets(); i++) { | |
154 | series->nextSet(0==i)->setBrush(QBrush(m_seriesColor.at(i%m_seriesColor.count()))); |
|
154 | series->nextSet(0==i)->setBrush(QBrush(m_seriesColor.at(i%m_seriesColor.count()))); | |
155 | } |
|
155 | } | |
156 | } |
|
156 | } | |
157 |
|
157 | |||
158 |
void ChartTheme::decorate(PercentBarPresenter* item, QPercentBar |
|
158 | void ChartTheme::decorate(PercentBarPresenter* item, QPercentBarSeries* series,int count) | |
159 | { |
|
159 | { | |
160 | for (int i=0; i<series->countSets(); i++) { |
|
160 | for (int i=0; i<series->countSets(); i++) { | |
161 | series->nextSet(0==i)->setBrush(QBrush(m_seriesColor.at(i%m_seriesColor.count()))); |
|
161 | series->nextSet(0==i)->setBrush(QBrush(m_seriesColor.at(i%m_seriesColor.count()))); |
@@ -12,10 +12,10 class QChartSeries; | |||||
12 | class LineChartItem; |
|
12 | class LineChartItem; | |
13 | class QLineChartSeries; |
|
13 | class QLineChartSeries; | |
14 | class BarPresenter; |
|
14 | class BarPresenter; | |
15 |
class QBar |
|
15 | class QBarSeries; | |
16 | class StackedBarPresenter; |
|
16 | class StackedBarPresenter; | |
17 |
class QStackedBar |
|
17 | class QStackedBarSeries; | |
18 |
class QPercentBar |
|
18 | class QPercentBarSeries; | |
19 | class PercentBarPresenter; |
|
19 | class PercentBarPresenter; | |
20 | class QScatterSeries; |
|
20 | class QScatterSeries; | |
21 | class ScatterPresenter; |
|
21 | class ScatterPresenter; | |
@@ -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(BarPresenter* item, QBar |
|
35 | void decorate(BarPresenter* item, QBarSeries* series,int count); | |
36 |
void decorate(StackedBarPresenter* item, QStackedBar |
|
36 | void decorate(StackedBarPresenter* item, QStackedBarSeries* series,int count); | |
37 |
void decorate(PercentBarPresenter* item, QPercentBar |
|
37 | void decorate(PercentBarPresenter* item, QPercentBarSeries* 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); |
@@ -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 <qbar |
|
9 | #include <qbarseries.h> | |
10 |
#include <qstackedbar |
|
10 | #include <qstackedbarseries.h> | |
11 |
#include <qpercentbar |
|
11 | #include <qpercentbarseries.h> | |
12 | #include <QPushButton> |
|
12 | #include <QPushButton> | |
13 | #include <QComboBox> |
|
13 | #include <QComboBox> | |
14 | #include <QSpinBox> |
|
14 | #include <QSpinBox> | |
@@ -255,13 +255,13 void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS | |||||
255 | QStringList labels = generateLabels(rowCount); |
|
255 | QStringList labels = generateLabels(rowCount); | |
256 | foreach(QString label, labels) |
|
256 | foreach(QString label, labels) | |
257 | *category << label; |
|
257 | *category << label; | |
258 |
QBar |
|
258 | QBarSeries* series = 0; | |
259 | if (seriesName == "Bar") |
|
259 | if (seriesName == "Bar") | |
260 |
series = new QBar |
|
260 | series = new QBarSeries(category, this); | |
261 | else if (seriesName == "Stacked bar") |
|
261 | else if (seriesName == "Stacked bar") | |
262 |
series = new QStackedBar |
|
262 | series = new QStackedBarSeries(category, this); | |
263 | else |
|
263 | else | |
264 |
series = new QPercentBar |
|
264 | series = new QPercentBarSeries(category, this); | |
265 |
|
265 | |||
266 | for (int j(0); j < data.count(); j++) { |
|
266 | for (int j(0); j < data.count(); j++) { | |
267 | QList<qreal> column = data.at(j); |
|
267 | QList<qreal> column = data.at(j); |
General Comments 0
You need to be logged in to leave comments.
Login now