@@ -26,7 +26,7 | |||||
26 | #include <QChartView> |
|
26 | #include <QChartView> | |
27 | #include <QLineSeries> |
|
27 | #include <QLineSeries> | |
28 | #include <QVXYModelMapper> |
|
28 | #include <QVXYModelMapper> | |
29 |
#include <Q |
|
29 | #include <QBarSeries> | |
30 | #include <QBarSet> |
|
30 | #include <QBarSet> | |
31 | #include <QVBarModelMapper> |
|
31 | #include <QVBarModelMapper> | |
32 | #include <QHeaderView> |
|
32 | #include <QHeaderView> | |
@@ -59,7 +59,7 TableWidget::TableWidget(QWidget *parent) | |||||
59 |
|
59 | |||
60 | // series 1 |
|
60 | // series 1 | |
61 | //! [4] |
|
61 | //! [4] | |
62 |
Q |
|
62 | QBarSeries *series = new QBarSeries; | |
63 |
|
63 | |||
64 | int first = 3; |
|
64 | int first = 3; | |
65 | int count = 5; |
|
65 | int count = 5; |
@@ -21,7 +21,7 | |||||
21 | #include <QApplication> |
|
21 | #include <QApplication> | |
22 | #include <QMainWindow> |
|
22 | #include <QMainWindow> | |
23 | #include <QChartView> |
|
23 | #include <QChartView> | |
24 |
#include <Q |
|
24 | #include <QBarSeries> | |
25 | #include <QBarSet> |
|
25 | #include <QBarSet> | |
26 | #include <QLegend> |
|
26 | #include <QLegend> | |
27 | #include <QCategoriesAxis> |
|
27 | #include <QCategoriesAxis> | |
@@ -47,7 +47,7 int main(int argc, char *argv[]) | |||||
47 | //![1] |
|
47 | //![1] | |
48 |
|
48 | |||
49 | //![2] |
|
49 | //![2] | |
50 |
Q |
|
50 | QBarSeries* series = new QBarSeries(); | |
51 | series->append(set0); |
|
51 | series->append(set0); | |
52 | series->append(set1); |
|
52 | series->append(set1); | |
53 | series->append(set2); |
|
53 | series->append(set2); | |
@@ -59,7 +59,7 int main(int argc, char *argv[]) | |||||
59 | //![3] |
|
59 | //![3] | |
60 | QChart* chart = new QChart(); |
|
60 | QChart* chart = new QChart(); | |
61 | chart->addSeries(series); |
|
61 | chart->addSeries(series); | |
62 |
chart->setTitle("Simple |
|
62 | chart->setTitle("Simple barchart example"); | |
63 | chart->createDefaultAxes(); |
|
63 | chart->createDefaultAxes(); | |
64 | //![3] |
|
64 | //![3] | |
65 |
|
65 |
@@ -25,7 +25,7 | |||||
25 | #include <QLabel> |
|
25 | #include <QLabel> | |
26 | #include <QDebug> |
|
26 | #include <QDebug> | |
27 | #include <QBarSet> |
|
27 | #include <QBarSet> | |
28 |
#include <Q |
|
28 | #include <QBarSeries> | |
29 | #include <QLegend> |
|
29 | #include <QLegend> | |
30 | #include <QFormLayout> |
|
30 | #include <QFormLayout> | |
31 |
|
31 | |||
@@ -118,7 +118,7 MainWidget::MainWidget(QWidget *parent) : | |||||
118 |
|
118 | |||
119 | void MainWidget::createSeries() |
|
119 | void MainWidget::createSeries() | |
120 | { |
|
120 | { | |
121 |
m_series = new Q |
|
121 | m_series = new QBarSeries(); | |
122 | addBarset(); |
|
122 | addBarset(); | |
123 | addBarset(); |
|
123 | addBarset(); | |
124 | addBarset(); |
|
124 | addBarset(); |
@@ -30,7 +30,7 | |||||
30 | #include <QGraphicsGridLayout> |
|
30 | #include <QGraphicsGridLayout> | |
31 | #include <QDoubleSpinBox> |
|
31 | #include <QDoubleSpinBox> | |
32 | #include <QGroupBox> |
|
32 | #include <QGroupBox> | |
33 |
#include <Q |
|
33 | #include <QBarSeries> | |
34 |
|
34 | |||
35 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
35 | QTCOMMERCIALCHART_USE_NAMESPACE | |
36 |
|
36 | |||
@@ -66,7 +66,7 public slots: | |||||
66 | private: |
|
66 | private: | |
67 |
|
67 | |||
68 | QChart *m_chart; |
|
68 | QChart *m_chart; | |
69 |
Q |
|
69 | QBarSeries *m_series; | |
70 |
|
70 | |||
71 | QChartView *m_chartView; |
|
71 | QChartView *m_chartView; | |
72 | QGridLayout *m_mainLayout; |
|
72 | QGridLayout *m_mainLayout; |
@@ -160,16 +160,16 DeclarativeBarSet *DeclarativeAbstractBarSeries::insert(int index, QString label | |||||
160 | return 0; |
|
160 | return 0; | |
161 | } |
|
161 | } | |
162 |
|
162 | |||
163 |
Declarative |
|
163 | DeclarativeBarSeries::DeclarativeBarSeries(QDeclarativeItem *parent) : | |
164 |
Q |
|
164 | QBarSeries(parent) | |
165 | { |
|
165 | { | |
166 | } |
|
166 | } | |
167 |
|
167 | |||
168 |
void Declarative |
|
168 | void DeclarativeBarSeries::classBegin() | |
169 | { |
|
169 | { | |
170 | } |
|
170 | } | |
171 |
|
171 | |||
172 |
void Declarative |
|
172 | void DeclarativeBarSeries::componentComplete() | |
173 | { |
|
173 | { | |
174 | foreach(QObject *child, children()) { |
|
174 | foreach(QObject *child, children()) { | |
175 | if (qobject_cast<DeclarativeBarSet *>(child)) { |
|
175 | if (qobject_cast<DeclarativeBarSet *>(child)) { | |
@@ -184,39 +184,39 void DeclarativeGroupedBarSeries::componentComplete() | |||||
184 | } |
|
184 | } | |
185 | } |
|
185 | } | |
186 |
|
186 | |||
187 |
void Declarative |
|
187 | void DeclarativeBarSeries::setAxisX(QAbstractAxis *axis) | |
188 | { |
|
188 | { | |
189 | chart()->setAxisX(axis, this); |
|
189 | chart()->setAxisX(axis, this); | |
190 | } |
|
190 | } | |
191 |
|
191 | |||
192 |
QAbstractAxis *Declarative |
|
192 | QAbstractAxis *DeclarativeBarSeries::axisX() | |
193 | { |
|
193 | { | |
194 | return chart()->axisX(this); |
|
194 | return chart()->axisX(this); | |
195 | } |
|
195 | } | |
196 |
|
196 | |||
197 |
void Declarative |
|
197 | void DeclarativeBarSeries::setAxisY(QAbstractAxis *axis) | |
198 | { |
|
198 | { | |
199 | chart()->setAxisY(axis, this); |
|
199 | chart()->setAxisY(axis, this); | |
200 | } |
|
200 | } | |
201 |
|
201 | |||
202 |
QAbstractAxis *Declarative |
|
202 | QAbstractAxis *DeclarativeBarSeries::axisY() | |
203 | { |
|
203 | { | |
204 | return chart()->axisY(this); |
|
204 | return chart()->axisY(this); | |
205 | } |
|
205 | } | |
206 |
|
206 | |||
207 |
QDeclarativeListProperty<QObject> Declarative |
|
207 | QDeclarativeListProperty<QObject> DeclarativeBarSeries::seriesChildren() | |
208 | { |
|
208 | { | |
209 | return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeAbstractBarSeries::appendSeriesChildren); |
|
209 | return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeAbstractBarSeries::appendSeriesChildren); | |
210 | } |
|
210 | } | |
211 |
|
211 | |||
212 |
void Declarative |
|
212 | void DeclarativeBarSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element) | |
213 | { |
|
213 | { | |
214 | // Empty implementation; the children are parsed in componentComplete instead |
|
214 | // Empty implementation; the children are parsed in componentComplete instead | |
215 | Q_UNUSED(list); |
|
215 | Q_UNUSED(list); | |
216 | Q_UNUSED(element); |
|
216 | Q_UNUSED(element); | |
217 | } |
|
217 | } | |
218 |
|
218 | |||
219 |
DeclarativeBarSet *Declarative |
|
219 | DeclarativeBarSet *DeclarativeBarSeries::at(int index) | |
220 | { |
|
220 | { | |
221 | QList<QBarSet*> setList = barSets(); |
|
221 | QList<QBarSet*> setList = barSets(); | |
222 | if (index >= 0 && index < setList.count()) |
|
222 | if (index >= 0 && index < setList.count()) | |
@@ -225,12 +225,12 DeclarativeBarSet *DeclarativeGroupedBarSeries::at(int index) | |||||
225 | return 0; |
|
225 | return 0; | |
226 | } |
|
226 | } | |
227 |
|
227 | |||
228 |
DeclarativeBarSet *Declarative |
|
228 | DeclarativeBarSet *DeclarativeBarSeries::insert(int index, QString label, QVariantList values) | |
229 | { |
|
229 | { | |
230 | DeclarativeBarSet *barset = new DeclarativeBarSet(this); |
|
230 | DeclarativeBarSet *barset = new DeclarativeBarSet(this); | |
231 | barset->setLabel(label); |
|
231 | barset->setLabel(label); | |
232 | barset->setValues(values); |
|
232 | barset->setValues(values); | |
233 |
if (Q |
|
233 | if (QBarSeries::insert(index, barset)) | |
234 | return barset; |
|
234 | return barset; | |
235 | delete barset; |
|
235 | delete barset; | |
236 | return 0; |
|
236 | return 0; |
@@ -22,7 +22,8 | |||||
22 | #define DECLARATIVEBARSERIES_H |
|
22 | #define DECLARATIVEBARSERIES_H | |
23 |
|
23 | |||
24 | #include "qchartglobal.h" |
|
24 | #include "qchartglobal.h" | |
25 |
#include "q |
|
25 | #include "qabstractbarseries.h" | |
|
26 | #include "qbarseries.h" | |||
26 | #include "qstackedbarseries.h" |
|
27 | #include "qstackedbarseries.h" | |
27 | #include "qpercentbarseries.h" |
|
28 | #include "qpercentbarseries.h" | |
28 | #include "qbarset.h" |
|
29 | #include "qbarset.h" | |
@@ -94,7 +95,7 public Q_SLOTS: | |||||
94 | void handleRemoved(QList<QBarSet* > barsets); |
|
95 | void handleRemoved(QList<QBarSet* > barsets); | |
95 | }; |
|
96 | }; | |
96 |
|
97 | |||
97 |
class Declarative |
|
98 | class DeclarativeBarSeries : public QBarSeries, public QDeclarativeParserStatus | |
98 | { |
|
99 | { | |
99 | Q_OBJECT |
|
100 | Q_OBJECT | |
100 | Q_INTERFACES(QDeclarativeParserStatus) |
|
101 | Q_INTERFACES(QDeclarativeParserStatus) | |
@@ -104,7 +105,7 class DeclarativeGroupedBarSeries : public QGroupedBarSeries, public QDeclarativ | |||||
104 | Q_CLASSINFO("DefaultProperty", "seriesChildren") |
|
105 | Q_CLASSINFO("DefaultProperty", "seriesChildren") | |
105 |
|
106 | |||
106 | public: |
|
107 | public: | |
107 |
explicit Declarative |
|
108 | explicit DeclarativeBarSeries(QDeclarativeItem *parent = 0); | |
108 | void setAxisX(QAbstractAxis *axis); |
|
109 | void setAxisX(QAbstractAxis *axis); | |
109 | QAbstractAxis *axisX(); |
|
110 | QAbstractAxis *axisX(); | |
110 | void setAxisY(QAbstractAxis *axis); |
|
111 | void setAxisY(QAbstractAxis *axis); | |
@@ -113,8 +114,8 public: | |||||
113 | Q_INVOKABLE DeclarativeBarSet *at(int index); |
|
114 | Q_INVOKABLE DeclarativeBarSet *at(int index); | |
114 | Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); } |
|
115 | Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); } | |
115 | Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values); |
|
116 | Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values); | |
116 |
Q_INVOKABLE bool remove(QBarSet *barset) { return Q |
|
117 | Q_INVOKABLE bool remove(QBarSet *barset) { return QBarSeries::remove(barset); } | |
117 |
Q_INVOKABLE void clear() { return Q |
|
118 | Q_INVOKABLE void clear() { return QBarSeries::clear(); } | |
118 |
|
119 | |||
119 | public: // from QDeclarativeParserStatus |
|
120 | public: // from QDeclarativeParserStatus | |
120 | void classBegin(); |
|
121 | void classBegin(); |
@@ -473,8 +473,8 QAbstractSeries *DeclarativeChart::createSeries(DeclarativeChart::SeriesType typ | |||||
473 | case DeclarativeChart::SeriesTypePercentBar: |
|
473 | case DeclarativeChart::SeriesTypePercentBar: | |
474 | // TODO |
|
474 | // TODO | |
475 | break; |
|
475 | break; | |
476 |
case DeclarativeChart::SeriesType |
|
476 | case DeclarativeChart::SeriesTypeBar: | |
477 |
series = new Declarative |
|
477 | series = new DeclarativeBarSeries(); | |
478 | break; |
|
478 | break; | |
479 | case DeclarativeChart::SeriesTypePie: |
|
479 | case DeclarativeChart::SeriesTypePie: | |
480 | series = new DeclarativePieSeries(); |
|
480 | series = new DeclarativePieSeries(); |
@@ -77,7 +77,6 public: | |||||
77 | SeriesTypeBar, |
|
77 | SeriesTypeBar, | |
78 | SeriesTypeStackedBar, |
|
78 | SeriesTypeStackedBar, | |
79 | SeriesTypePercentBar, |
|
79 | SeriesTypePercentBar, | |
80 | SeriesTypeGroupedBar, |
|
|||
81 | SeriesTypePie, |
|
80 | SeriesTypePie, | |
82 | SeriesTypeScatter, |
|
81 | SeriesTypeScatter, | |
83 | SeriesTypeSpline |
|
82 | SeriesTypeSpline |
@@ -55,7 +55,7 public: | |||||
55 | qmlRegisterType<DeclarativeLineSeries>(uri, 1, 0, "LineSeries"); |
|
55 | qmlRegisterType<DeclarativeLineSeries>(uri, 1, 0, "LineSeries"); | |
56 | qmlRegisterType<DeclarativeSplineSeries>(uri, 1, 0, "SplineSeries"); |
|
56 | qmlRegisterType<DeclarativeSplineSeries>(uri, 1, 0, "SplineSeries"); | |
57 | qmlRegisterType<DeclarativeAreaSeries>(uri, 1, 0, "AreaSeries"); |
|
57 | qmlRegisterType<DeclarativeAreaSeries>(uri, 1, 0, "AreaSeries"); | |
58 |
qmlRegisterType<Declarative |
|
58 | qmlRegisterType<DeclarativeBarSeries>(uri, 1, 0, "BarSeries"); | |
59 | qmlRegisterType<DeclarativeStackedBarSeries>(uri, 1, 0, "StackedBarSeries"); |
|
59 | qmlRegisterType<DeclarativeStackedBarSeries>(uri, 1, 0, "StackedBarSeries"); | |
60 | qmlRegisterType<DeclarativePercentBarSeries>(uri, 1, 0, "PercentBarSeries"); |
|
60 | qmlRegisterType<DeclarativePercentBarSeries>(uri, 1, 0, "PercentBarSeries"); | |
61 | qmlRegisterType<DeclarativePieSeries>(uri, 1, 0, "PieSeries"); |
|
61 | qmlRegisterType<DeclarativePieSeries>(uri, 1, 0, "PieSeries"); |
@@ -55,7 +55,7 public: | |||||
55 | virtual ~ChartAnimator(); |
|
55 | virtual ~ChartAnimator(); | |
56 |
|
56 | |||
57 | void addAnimation(PieChartItem *item); |
|
57 | void addAnimation(PieChartItem *item); | |
58 |
void addAnimation(BarChartItem *item); |
|
58 | void addAnimation(BarChartItem *item); | |
59 | void addAnimation(StackedBarChartItem *item); |
|
59 | void addAnimation(StackedBarChartItem *item); | |
60 | void addAnimation(PercentBarChartItem *item); |
|
60 | void addAnimation(PercentBarChartItem *item); | |
61 | void removeAnimation(Chart *item); |
|
61 | void removeAnimation(Chart *item); |
@@ -10,7 +10,7 SOURCES += \ | |||||
10 | $$PWD/qbarset.cpp \ |
|
10 | $$PWD/qbarset.cpp \ | |
11 | $$PWD/qpercentbarseries.cpp \ |
|
11 | $$PWD/qpercentbarseries.cpp \ | |
12 | $$PWD/qstackedbarseries.cpp \ |
|
12 | $$PWD/qstackedbarseries.cpp \ | |
13 |
$$PWD/q |
|
13 | $$PWD/qbarseries.cpp \ | |
14 | $$PWD/stackedbarchartitem.cpp \ |
|
14 | $$PWD/stackedbarchartitem.cpp \ | |
15 | $$PWD/qbarmodelmapper.cpp \ |
|
15 | $$PWD/qbarmodelmapper.cpp \ | |
16 | $$PWD/qvbarmodelmapper.cpp \ |
|
16 | $$PWD/qvbarmodelmapper.cpp \ | |
@@ -26,7 +26,7 PRIVATE_HEADERS += \ | |||||
26 | $$PWD/qabstractbarseries_p.h \ |
|
26 | $$PWD/qabstractbarseries_p.h \ | |
27 | $$PWD/qstackedbarseries_p.h\ |
|
27 | $$PWD/qstackedbarseries_p.h\ | |
28 | $$PWD/qpercentbarseries_p.h \ |
|
28 | $$PWD/qpercentbarseries_p.h \ | |
29 |
$$PWD/q |
|
29 | $$PWD/qbarseries_p.h \ | |
30 | $$PWD/qbarmodelmapper_p.h |
|
30 | $$PWD/qbarmodelmapper_p.h | |
31 |
|
31 | |||
32 | PUBLIC_HEADERS += \ |
|
32 | PUBLIC_HEADERS += \ | |
@@ -34,7 +34,7 PUBLIC_HEADERS += \ | |||||
34 | $$PWD/qbarset.h \ |
|
34 | $$PWD/qbarset.h \ | |
35 | $$PWD/qpercentbarseries.h \ |
|
35 | $$PWD/qpercentbarseries.h \ | |
36 | $$PWD/qstackedbarseries.h \ |
|
36 | $$PWD/qstackedbarseries.h \ | |
37 |
$$PWD/q |
|
37 | $$PWD/qbarseries.h \ | |
38 | $$PWD/qbarmodelmapper.h \ |
|
38 | $$PWD/qbarmodelmapper.h \ | |
39 | $$PWD/qvbarmodelmapper.h \ |
|
39 | $$PWD/qvbarmodelmapper.h \ | |
40 | $$PWD/qhbarmodelmapper.h |
|
40 | $$PWD/qhbarmodelmapper.h |
@@ -65,15 +65,15 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
65 | The width of the bars of the series. The unit of \a width is the unit of x-axis. The minimum width for bars |
|
65 | The width of the bars of the series. The unit of \a width is the unit of x-axis. The minimum width for bars | |
66 | is zero and negative values are treated as zero. Setting the width to zero means that width of the bar on screen |
|
66 | is zero and negative values are treated as zero. Setting the width to zero means that width of the bar on screen | |
67 | is one pixel no matter what the scale of x-axis is. Bars wider than zero are scaled with x-axis. |
|
67 | is one pixel no matter what the scale of x-axis is. Bars wider than zero are scaled with x-axis. | |
68 |
Note that with Q |
|
68 | Note that with QBarSeries this value means the width of one group of bars instead of just one bar. | |
69 |
\sa Q |
|
69 | \sa QBarSeries | |
70 | */ |
|
70 | */ | |
71 | /*! |
|
71 | /*! | |
72 | \qmlproperty real AbstractBarSeries::barWidth |
|
72 | \qmlproperty real AbstractBarSeries::barWidth | |
73 | The width of the bars of the series. The unit of width is the unit of x-axis. The minimum width for bars |
|
73 | The width of the bars of the series. The unit of width is the unit of x-axis. The minimum width for bars | |
74 | is zero and negative values are treated as zero. Setting the width to zero means that width of the bar on screen |
|
74 | is zero and negative values are treated as zero. Setting the width to zero means that width of the bar on screen | |
75 | is one pixel no matter what the scale of x-axis is. Bars wider than zero are scaled with x-axis. |
|
75 | is one pixel no matter what the scale of x-axis is. Bars wider than zero are scaled with x-axis. | |
76 |
Note that with Q |
|
76 | Note that with QBarSeries this value means the width of one group of bars instead of just one bar. | |
77 | */ |
|
77 | */ | |
78 |
|
78 | |||
79 | /*! |
|
79 | /*! | |
@@ -220,7 +220,7 QAbstractBarSeries::QAbstractBarSeries(QAbstractBarSeriesPrivate &d, QObject *pa | |||||
220 | Sets the width of the bars of the series. The unit of \a width is the unit of x-axis. The minimum width for bars |
|
220 | Sets the width of the bars of the series. The unit of \a width is the unit of x-axis. The minimum width for bars | |
221 | is zero and negative values are treated as zero. Setting the width to zero means that width of the bar on screen |
|
221 | is zero and negative values are treated as zero. Setting the width to zero means that width of the bar on screen | |
222 | is one pixel no matter what the scale of x-axis is. Bars wider than zero are scaled with x-axis. |
|
222 | is one pixel no matter what the scale of x-axis is. Bars wider than zero are scaled with x-axis. | |
223 |
Note that with \link Q |
|
223 | Note that with \link QBarSeries \endlink this value means the width of one group of bars instead of just one bar. | |
224 | */ |
|
224 | */ | |
225 | void QAbstractBarSeries::setBarWidth(qreal width) |
|
225 | void QAbstractBarSeries::setBarWidth(qreal width) | |
226 | { |
|
226 | { |
@@ -18,8 +18,8 | |||||
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 |
#include "q |
|
21 | #include "qbarseries.h" | |
22 |
#include "q |
|
22 | #include "qbarseries_p.h" | |
23 | #include "groupedbarchartitem_p.h" |
|
23 | #include "groupedbarchartitem_p.h" | |
24 | #include "chartdataset_p.h" |
|
24 | #include "chartdataset_p.h" | |
25 | #include "charttheme_p.h" |
|
25 | #include "charttheme_p.h" | |
@@ -30,12 +30,12 | |||||
30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
31 |
|
31 | |||
32 | /*! |
|
32 | /*! | |
33 |
\class Q |
|
33 | \class QBarSeries | |
34 |
\brief Series for creating |
|
34 | \brief Series for creating bar chart | |
35 | \mainclass |
|
35 | \mainclass | |
36 |
|
36 | |||
37 |
Q |
|
37 | QBarSeries represents a series of data shown as bars. The purpose of this class is to draw bars | |
38 |
as groups, where bars in same category are grouped next to each other. Q |
|
38 | as groups, where bars in same category are grouped next to each other. QBarSeries groups the data | |
39 | from sets to categories, which are defined by a QStringList. |
|
39 | from sets to categories, which are defined by a QStringList. | |
40 |
|
40 | |||
41 | See the \l {GroupedbarChart Example} {grouped bar chart example} to learn how to create a grouped bar chart. |
|
41 | See the \l {GroupedbarChart Example} {grouped bar chart example} to learn how to create a grouped bar chart. | |
@@ -44,7 +44,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
44 | \sa QBarSet, QPercentBarSeries, QAbstractBarSeries, QStackedBarSeries |
|
44 | \sa QBarSet, QPercentBarSeries, QAbstractBarSeries, QStackedBarSeries | |
45 | */ |
|
45 | */ | |
46 | /*! |
|
46 | /*! | |
47 |
\qmlclass |
|
47 | \qmlclass BarSeries QBarSeries | |
48 | \inherits AbstractBarSeries |
|
48 | \inherits AbstractBarSeries | |
49 |
|
49 | |||
50 | The following QML shows how to create a simple grouped bar chart: |
|
50 | The following QML shows how to create a simple grouped bar chart: | |
@@ -56,30 +56,30 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
56 | */ |
|
56 | */ | |
57 |
|
57 | |||
58 | /*! |
|
58 | /*! | |
59 |
Constructs empty Q |
|
59 | Constructs empty QBarSeries. | |
60 |
Q |
|
60 | QBarSeries is QObject which is a child of a \a parent. | |
61 | */ |
|
61 | */ | |
62 |
Q |
|
62 | QBarSeries::QBarSeries(QObject *parent) | |
63 |
: QAbstractBarSeries(*new Q |
|
63 | : QAbstractBarSeries(*new QBarSeriesPrivate(this), parent) | |
64 | { |
|
64 | { | |
65 | } |
|
65 | } | |
66 |
|
66 | |||
67 | /*! |
|
67 | /*! | |
68 | Returns QChartSeries::SeriesTypeGroupedBar. |
|
68 | Returns QChartSeries::SeriesTypeGroupedBar. | |
69 | */ |
|
69 | */ | |
70 |
QAbstractSeries::SeriesType Q |
|
70 | QAbstractSeries::SeriesType QBarSeries::type() const | |
71 | { |
|
71 | { | |
72 |
return QAbstractSeries::SeriesType |
|
72 | return QAbstractSeries::SeriesTypeBar; | |
73 | } |
|
73 | } | |
74 |
|
74 | |||
75 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
75 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
76 |
|
76 | |||
77 |
Q |
|
77 | QBarSeriesPrivate::QBarSeriesPrivate(QBarSeries *q) : QAbstractBarSeriesPrivate(q) | |
78 | { |
|
78 | { | |
79 |
|
79 | |||
80 | } |
|
80 | } | |
81 |
|
81 | |||
82 |
void Q |
|
82 | void QBarSeriesPrivate::scaleDomain(Domain& domain) | |
83 | { |
|
83 | { | |
84 | qreal minX(domain.minX()); |
|
84 | qreal minX(domain.minX()); | |
85 | qreal minY(domain.minY()); |
|
85 | qreal minY(domain.minY()); | |
@@ -100,9 +100,9 void QGroupedBarSeriesPrivate::scaleDomain(Domain& domain) | |||||
100 | } |
|
100 | } | |
101 |
|
101 | |||
102 |
|
102 | |||
103 |
Chart* Q |
|
103 | Chart* QBarSeriesPrivate::createGraphics(ChartPresenter* presenter) | |
104 | { |
|
104 | { | |
105 |
Q_Q(Q |
|
105 | Q_Q(QBarSeries); | |
106 |
|
106 | |||
107 | GroupedBarChartItem* bar = new GroupedBarChartItem(q,presenter); |
|
107 | GroupedBarChartItem* bar = new GroupedBarChartItem(q,presenter); | |
108 | if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) { |
|
108 | if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) { | |
@@ -113,7 +113,7 Chart* QGroupedBarSeriesPrivate::createGraphics(ChartPresenter* presenter) | |||||
113 | } |
|
113 | } | |
114 |
|
114 | |||
115 |
|
115 | |||
116 |
#include "moc_q |
|
116 | #include "moc_qbarseries.cpp" | |
117 |
|
117 | |||
118 | QTCOMMERCIALCHART_END_NAMESPACE |
|
118 | QTCOMMERCIALCHART_END_NAMESPACE | |
119 |
|
119 |
@@ -18,28 +18,28 | |||||
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 |
#ifndef |
|
21 | #ifndef QBARSERIES_H | |
22 |
#define |
|
22 | #define QBARSERIES_H | |
23 |
|
23 | |||
24 | #include <QStringList> |
|
24 | #include <QStringList> | |
25 | #include <qabstractbarseries.h> |
|
25 | #include <qabstractbarseries.h> | |
26 |
|
26 | |||
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
28 |
|
28 | |||
29 |
class Q |
|
29 | class QBarSeriesPrivate; | |
30 |
|
30 | |||
31 |
class QTCOMMERCIALCHART_EXPORT Q |
|
31 | class QTCOMMERCIALCHART_EXPORT QBarSeries : public QAbstractBarSeries | |
32 | { |
|
32 | { | |
33 | Q_OBJECT |
|
33 | Q_OBJECT | |
34 | public: |
|
34 | public: | |
35 |
explicit Q |
|
35 | explicit QBarSeries(QObject *parent = 0); | |
36 | QAbstractSeries::SeriesType type() const; |
|
36 | QAbstractSeries::SeriesType type() const; | |
37 |
|
37 | |||
38 | private: |
|
38 | private: | |
39 |
Q_DECLARE_PRIVATE(Q |
|
39 | Q_DECLARE_PRIVATE(QBarSeries) | |
40 |
Q_DISABLE_COPY(Q |
|
40 | Q_DISABLE_COPY(QBarSeries) | |
41 | }; |
|
41 | }; | |
42 |
|
42 | |||
43 | QTCOMMERCIALCHART_END_NAMESPACE |
|
43 | QTCOMMERCIALCHART_END_NAMESPACE | |
44 |
|
44 | |||
45 |
#endif // |
|
45 | #endif // QBARSERIES_H |
@@ -27,8 +27,8 | |||||
27 | // |
|
27 | // | |
28 | // We mean it. |
|
28 | // We mean it. | |
29 |
|
29 | |||
30 |
#ifndef Q |
|
30 | #ifndef QBARSERIES_P_H | |
31 |
#define Q |
|
31 | #define QBARSERIES_P_H | |
32 |
|
32 | |||
33 | #include "qabstractbarseries_p.h" |
|
33 | #include "qabstractbarseries_p.h" | |
34 | #include "domain_p.h" |
|
34 | #include "domain_p.h" | |
@@ -36,17 +36,17 | |||||
36 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
36 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
37 |
|
37 | |||
38 |
|
38 | |||
39 |
class Q |
|
39 | class QBarSeriesPrivate: public QAbstractBarSeriesPrivate | |
40 | { |
|
40 | { | |
41 | public: |
|
41 | public: | |
42 |
Q |
|
42 | QBarSeriesPrivate(QBarSeries* q); | |
43 | Chart* createGraphics(ChartPresenter* presenter); |
|
43 | Chart* createGraphics(ChartPresenter* presenter); | |
44 | void scaleDomain(Domain& domain); |
|
44 | void scaleDomain(Domain& domain); | |
45 |
|
45 | |||
46 | private: |
|
46 | private: | |
47 |
Q_DECLARE_PUBLIC(Q |
|
47 | Q_DECLARE_PUBLIC(QBarSeries) | |
48 | }; |
|
48 | }; | |
49 |
|
49 | |||
50 | QTCOMMERCIALCHART_END_NAMESPACE |
|
50 | QTCOMMERCIALCHART_END_NAMESPACE | |
51 |
|
51 | |||
52 |
#endif // Q |
|
52 | #endif // QBARSERIES_P_H |
@@ -34,7 +34,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
34 |
|
34 | |||
35 | \mainclass |
|
35 | \mainclass | |
36 |
|
36 | |||
37 |
\sa QAbstractBarSeries, Q |
|
37 | \sa QAbstractBarSeries, QBarSeries, QStackedBarSeries, QPercentBarSeries | |
38 | */ |
|
38 | */ | |
39 | /*! |
|
39 | /*! | |
40 | \qmlclass BarSet QBarSet |
|
40 | \qmlclass BarSet QBarSet | |
@@ -43,7 +43,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
43 | First value of set is assumed to belong to first category, second to second category and so on. |
|
43 | First value of set is assumed to belong to first category, second to second category and so on. | |
44 | If set has fewer values than there are categories, then the missing values are assumed to be |
|
44 | If set has fewer values than there are categories, then the missing values are assumed to be | |
45 | at the end of set. For missing values in middle of a set, numerical value of zero is used. |
|
45 | at the end of set. For missing values in middle of a set, numerical value of zero is used. | |
46 |
\sa AbstractBarSeries, |
|
46 | \sa AbstractBarSeries, BarSeries, StackedBarSeries, PercentBarSeries | |
47 | */ |
|
47 | */ | |
48 |
|
48 | |||
49 | /*! |
|
49 | /*! |
@@ -45,7 +45,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
45 | model has at least four columns). Each bar set would contain data starting from row 1. The name of a set would be |
|
45 | model has at least four columns). Each bar set would contain data starting from row 1. The name of a set would be | |
46 | defined by the horizontal header (of the column). |
|
46 | defined by the horizontal header (of the column). | |
47 | \code |
|
47 | \code | |
48 |
|
|
48 | BarSeries { | |
49 | VBarModelMapper { |
|
49 | VBarModelMapper { | |
50 | model: myCustomModel // QAbstractItemModel derived implementation |
|
50 | model: myCustomModel // QAbstractItemModel derived implementation | |
51 | firstBarSetColumn: 1 |
|
51 | firstBarSetColumn: 1 |
@@ -49,7 +49,6 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
49 | \value SeriesTypeBar |
|
49 | \value SeriesTypeBar | |
50 | \value SeriesTypeStackedBar |
|
50 | \value SeriesTypeStackedBar | |
51 | \value SeriesTypePercentBar |
|
51 | \value SeriesTypePercentBar | |
52 | \value SeriesTypeGroupedBar |
|
|||
53 | \value SeriesTypePie |
|
52 | \value SeriesTypePie | |
54 | \value SeriesTypeScatter |
|
53 | \value SeriesTypeScatter | |
55 | \value SeriesTypeSpline |
|
54 | \value SeriesTypeSpline |
@@ -46,7 +46,6 public: | |||||
46 | SeriesTypeBar, |
|
46 | SeriesTypeBar, | |
47 | SeriesTypeStackedBar, |
|
47 | SeriesTypeStackedBar, | |
48 | SeriesTypePercentBar, |
|
48 | SeriesTypePercentBar, | |
49 | SeriesTypeGroupedBar, |
|
|||
50 | SeriesTypePie, |
|
49 | SeriesTypePie, | |
51 | SeriesTypeScatter, |
|
50 | SeriesTypeScatter, | |
52 | SeriesTypeSpline |
|
51 | SeriesTypeSpline |
@@ -27,7 +27,7 | |||||
27 | #include <qscatterseries.h> |
|
27 | #include <qscatterseries.h> | |
28 | #include <qsplineseries.h> |
|
28 | #include <qsplineseries.h> | |
29 | #include <qpieseries.h> |
|
29 | #include <qpieseries.h> | |
30 |
#include <q |
|
30 | #include <qbarseries.h> | |
31 | #include <qpercentbarseries.h> |
|
31 | #include <qpercentbarseries.h> | |
32 | #include <qstackedbarseries.h> |
|
32 | #include <qstackedbarseries.h> | |
33 | #include <private/chartdataset_p.h> |
|
33 | #include <private/chartdataset_p.h> | |
@@ -135,7 +135,7 void tst_ChartDataSet::addSeries_data() | |||||
135 | QAbstractSeries* scatter = new QScatterSeries(this); |
|
135 | QAbstractSeries* scatter = new QScatterSeries(this); | |
136 | QAbstractSeries* spline = new QSplineSeries(this); |
|
136 | QAbstractSeries* spline = new QSplineSeries(this); | |
137 | QAbstractSeries* pie = new QPieSeries(this); |
|
137 | QAbstractSeries* pie = new QPieSeries(this); | |
138 |
QAbstractSeries* bar = new Q |
|
138 | QAbstractSeries* bar = new QBarSeries(this); | |
139 | QAbstractSeries* percent = new QPercentBarSeries(this); |
|
139 | QAbstractSeries* percent = new QPercentBarSeries(this); | |
140 | QAbstractSeries* stacked = new QStackedBarSeries(this); |
|
140 | QAbstractSeries* stacked = new QStackedBarSeries(this); | |
141 |
|
141 | |||
@@ -184,7 +184,7 void tst_ChartDataSet::setAxisX_data() | |||||
184 | QAbstractSeries* scatter = new QScatterSeries(this); |
|
184 | QAbstractSeries* scatter = new QScatterSeries(this); | |
185 | QAbstractSeries* spline = new QSplineSeries(this); |
|
185 | QAbstractSeries* spline = new QSplineSeries(this); | |
186 | QAbstractSeries* pie = new QPieSeries(this); |
|
186 | QAbstractSeries* pie = new QPieSeries(this); | |
187 |
QAbstractSeries* bar = new Q |
|
187 | QAbstractSeries* bar = new QBarSeries(this); | |
188 | QAbstractSeries* percent = new QPercentBarSeries(this); |
|
188 | QAbstractSeries* percent = new QPercentBarSeries(this); | |
189 | QAbstractSeries* stacked = new QStackedBarSeries(this); |
|
189 | QAbstractSeries* stacked = new QStackedBarSeries(this); | |
190 |
|
190 |
@@ -23,7 +23,7 | |||||
23 |
|
23 | |||
24 | #include <qchart.h> |
|
24 | #include <qchart.h> | |
25 | #include <qchartview.h> |
|
25 | #include <qchartview.h> | |
26 |
#include <q |
|
26 | #include <qbarseries.h> | |
27 | #include <qbarset.h> |
|
27 | #include <qbarset.h> | |
28 | #include <qvbarmodelmapper.h> |
|
28 | #include <qvbarmodelmapper.h> | |
29 | #include <qhbarmodelmapper.h> |
|
29 | #include <qhbarmodelmapper.h> | |
@@ -72,7 +72,7 class tst_qbarmodelmapper : public QObject | |||||
72 | QVBarModelMapper *m_vMapper; |
|
72 | QVBarModelMapper *m_vMapper; | |
73 | QHBarModelMapper *m_hMapper; |
|
73 | QHBarModelMapper *m_hMapper; | |
74 |
|
74 | |||
75 |
Q |
|
75 | QBarSeries *m_series; | |
76 | QChart *m_chart; |
|
76 | QChart *m_chart; | |
77 | }; |
|
77 | }; | |
78 |
|
78 | |||
@@ -109,7 +109,7 void tst_qbarmodelmapper::createHorizontalMapper() | |||||
109 |
|
109 | |||
110 | void tst_qbarmodelmapper::init() |
|
110 | void tst_qbarmodelmapper::init() | |
111 | { |
|
111 | { | |
112 |
m_series = new Q |
|
112 | m_series = new QBarSeries; | |
113 | m_chart->addSeries(m_series); |
|
113 | m_chart->addSeries(m_series); | |
114 |
|
114 | |||
115 | m_model = new QStandardItemModel(m_modelRowCount, m_modelColumnCount, this); |
|
115 | m_model = new QStandardItemModel(m_modelRowCount, m_modelColumnCount, this); | |
@@ -171,7 +171,7 void tst_qbarmodelmapper::verticalMapper() | |||||
171 | QFETCH(int, lastBarSetColumn); |
|
171 | QFETCH(int, lastBarSetColumn); | |
172 | QFETCH(int, expectedBarSetCount); |
|
172 | QFETCH(int, expectedBarSetCount); | |
173 |
|
173 | |||
174 |
m_series = new Q |
|
174 | m_series = new QBarSeries; | |
175 |
|
175 | |||
176 | QVBarModelMapper *mapper = new QVBarModelMapper; |
|
176 | QVBarModelMapper *mapper = new QVBarModelMapper; | |
177 | mapper->setFirstBarSetColumn(firstBarSetColumn); |
|
177 | mapper->setFirstBarSetColumn(firstBarSetColumn); | |
@@ -214,7 +214,7 void tst_qbarmodelmapper::verticalMapperCustomMapping() | |||||
214 | QFETCH(int, expectedBarSetCount); |
|
214 | QFETCH(int, expectedBarSetCount); | |
215 | QFETCH(int, expectedCount); |
|
215 | QFETCH(int, expectedCount); | |
216 |
|
216 | |||
217 |
m_series = new Q |
|
217 | m_series = new QBarSeries; | |
218 |
|
218 | |||
219 | QCOMPARE(m_series->count(), 0); |
|
219 | QCOMPARE(m_series->count(), 0); | |
220 |
|
220 | |||
@@ -261,7 +261,7 void tst_qbarmodelmapper::horizontalMapper() | |||||
261 | QFETCH(int, lastBarSetRow); |
|
261 | QFETCH(int, lastBarSetRow); | |
262 | QFETCH(int, expectedBarSetCount); |
|
262 | QFETCH(int, expectedBarSetCount); | |
263 |
|
263 | |||
264 |
m_series = new Q |
|
264 | m_series = new QBarSeries; | |
265 |
|
265 | |||
266 | QHBarModelMapper *mapper = new QHBarModelMapper; |
|
266 | QHBarModelMapper *mapper = new QHBarModelMapper; | |
267 | mapper->setFirstBarSetRow(firstBarSetRow); |
|
267 | mapper->setFirstBarSetRow(firstBarSetRow); | |
@@ -304,7 +304,7 void tst_qbarmodelmapper::horizontalMapperCustomMapping() | |||||
304 | QFETCH(int, expectedBarSetCount); |
|
304 | QFETCH(int, expectedBarSetCount); | |
305 | QFETCH(int, expectedCount); |
|
305 | QFETCH(int, expectedCount); | |
306 |
|
306 | |||
307 |
m_series = new Q |
|
307 | m_series = new QBarSeries; | |
308 |
|
308 | |||
309 | QCOMPARE(m_series->count(), 0); |
|
309 | QCOMPARE(m_series->count(), 0); | |
310 |
|
310 |
@@ -19,7 +19,7 | |||||
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include <QtTest/QtTest> |
|
21 | #include <QtTest/QtTest> | |
22 |
#include <q |
|
22 | #include <qbarseries.h> | |
23 | #include <qbarset.h> |
|
23 | #include <qbarset.h> | |
24 | #include <qchartview.h> |
|
24 | #include <qchartview.h> | |
25 | #include <qchart.h> |
|
25 | #include <qchart.h> | |
@@ -63,8 +63,8 private slots: | |||||
63 | void clearWithAnimations(); |
|
63 | void clearWithAnimations(); | |
64 |
|
64 | |||
65 | private: |
|
65 | private: | |
66 |
Q |
|
66 | QBarSeries* m_barseries; | |
67 |
Q |
|
67 | QBarSeries* m_barseries_with_sets; | |
68 |
|
68 | |||
69 | QList<QBarSet*> m_testSets; |
|
69 | QList<QBarSet*> m_testSets; | |
70 |
|
70 | |||
@@ -81,8 +81,8 void tst_QBarSeries::cleanupTestCase() | |||||
81 |
|
81 | |||
82 | void tst_QBarSeries::init() |
|
82 | void tst_QBarSeries::init() | |
83 | { |
|
83 | { | |
84 |
m_barseries = new Q |
|
84 | m_barseries = new QBarSeries(); | |
85 |
m_barseries_with_sets = new Q |
|
85 | m_barseries_with_sets = new QBarSeries(); | |
86 |
|
86 | |||
87 | for (int i=0; i<5; i++) { |
|
87 | for (int i=0; i<5; i++) { | |
88 | m_testSets.append(new QBarSet("testset")); |
|
88 | m_testSets.append(new QBarSet("testset")); | |
@@ -110,7 +110,7 void tst_QBarSeries::qbarseries_data() | |||||
110 |
|
110 | |||
111 | void tst_QBarSeries::qbarseries() |
|
111 | void tst_QBarSeries::qbarseries() | |
112 | { |
|
112 | { | |
113 |
Q |
|
113 | QBarSeries *barseries = new QBarSeries(); | |
114 | QVERIFY(barseries != 0); |
|
114 | QVERIFY(barseries != 0); | |
115 | } |
|
115 | } | |
116 |
|
116 | |||
@@ -316,7 +316,7 void tst_QBarSeries::mouseclicked_data() | |||||
316 |
|
316 | |||
317 | void tst_QBarSeries::mouseclicked() |
|
317 | void tst_QBarSeries::mouseclicked() | |
318 | { |
|
318 | { | |
319 |
Q |
|
319 | QBarSeries* series = new QBarSeries(); | |
320 |
|
320 | |||
321 | QBarSet* set1 = new QBarSet(QString("set 1")); |
|
321 | QBarSet* set1 = new QBarSet(QString("set 1")); | |
322 | *set1 << 10 << 10 << 10; |
|
322 | *set1 << 10 << 10 << 10; | |
@@ -452,7 +452,7 void tst_QBarSeries::mousehovered_data() | |||||
452 |
|
452 | |||
453 | void tst_QBarSeries::mousehovered() |
|
453 | void tst_QBarSeries::mousehovered() | |
454 | { |
|
454 | { | |
455 |
Q |
|
455 | QBarSeries* series = new QBarSeries(); | |
456 |
|
456 | |||
457 | QBarSet* set1 = new QBarSet(QString("set 1")); |
|
457 | QBarSet* set1 = new QBarSet(QString("set 1")); | |
458 | *set1 << 10 << 10 << 10; |
|
458 | *set1 << 10 << 10 << 10; | |
@@ -546,7 +546,7 void tst_QBarSeries::mousehovered() | |||||
546 |
|
546 | |||
547 | void tst_QBarSeries::clearWithAnimations() |
|
547 | void tst_QBarSeries::clearWithAnimations() | |
548 | { |
|
548 | { | |
549 |
Q |
|
549 | QBarSeries* series = new QBarSeries(); | |
550 |
|
550 | |||
551 | QBarSet* set1 = new QBarSet(QString("set 1")); |
|
551 | QBarSet* set1 = new QBarSet(QString("set 1")); | |
552 | *set1 << 10 << 10 << 10; |
|
552 | *set1 << 10 << 10 << 10; |
@@ -20,7 +20,7 | |||||
20 |
|
20 | |||
21 | #include <QtTest/QtTest> |
|
21 | #include <QtTest/QtTest> | |
22 | #include <qbarset.h> |
|
22 | #include <qbarset.h> | |
23 |
#include <q |
|
23 | #include <qbarseries.h> | |
24 | #include <qchartview.h> |
|
24 | #include <qchartview.h> | |
25 |
|
25 | |||
26 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
26 | QTCOMMERCIALCHART_USE_NAMESPACE | |
@@ -427,7 +427,7 void tst_QBarSet::customize() | |||||
427 | QBarSet *set2 = new QBarSet("set2"); |
|
427 | QBarSet *set2 = new QBarSet("set2"); | |
428 |
|
428 | |||
429 | // Append set1 to series |
|
429 | // Append set1 to series | |
430 |
Q |
|
430 | QBarSeries *series = new QBarSeries(); | |
431 | bool success = series->append(set1); |
|
431 | bool success = series->append(set1); | |
432 | QVERIFY(success); |
|
432 | QVERIFY(success); | |
433 |
|
433 |
@@ -26,7 +26,7 | |||||
26 | #include <qsplineseries.h> |
|
26 | #include <qsplineseries.h> | |
27 | #include <qpieseries.h> |
|
27 | #include <qpieseries.h> | |
28 | #include <qabstractbarseries.h> |
|
28 | #include <qabstractbarseries.h> | |
29 |
#include <q |
|
29 | #include <qbarseries.h> | |
30 | #include <qpercentbarseries.h> |
|
30 | #include <qpercentbarseries.h> | |
31 | #include <qstackedbarseries.h> |
|
31 | #include <qstackedbarseries.h> | |
32 | #include <qvaluesaxis.h> |
|
32 | #include <qvaluesaxis.h> | |
@@ -178,7 +178,7 void tst_QChart::addSeries_data() | |||||
178 | QAbstractSeries* series2 = new QScatterSeries(this); |
|
178 | QAbstractSeries* series2 = new QScatterSeries(this); | |
179 | QAbstractSeries* series3 = new QSplineSeries(this); |
|
179 | QAbstractSeries* series3 = new QSplineSeries(this); | |
180 | QAbstractSeries* series4 = new QPieSeries(this); |
|
180 | QAbstractSeries* series4 = new QPieSeries(this); | |
181 |
QAbstractSeries* series5 = new Q |
|
181 | QAbstractSeries* series5 = new QBarSeries(this); | |
182 | QAbstractSeries* series6 = new QPercentBarSeries(this); |
|
182 | QAbstractSeries* series6 = new QPercentBarSeries(this); | |
183 | QAbstractSeries* series7 = new QStackedBarSeries(this); |
|
183 | QAbstractSeries* series7 = new QStackedBarSeries(this); | |
184 |
|
184 |
@@ -19,7 +19,7 | |||||
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include <QtTest/QtTest> |
|
21 | #include <QtTest/QtTest> | |
22 |
#include <q |
|
22 | #include <qbarseries.h> | |
23 | #include <qbarset.h> |
|
23 | #include <qbarset.h> | |
24 | #include <qchartview.h> |
|
24 | #include <qchartview.h> | |
25 | #include <qchart.h> |
|
25 | #include <qchart.h> | |
@@ -52,7 +52,7 private slots: | |||||
52 | void mousehovered(); |
|
52 | void mousehovered(); | |
53 |
|
53 | |||
54 | private: |
|
54 | private: | |
55 |
Q |
|
55 | QBarSeries* m_barseries; | |
56 | }; |
|
56 | }; | |
57 |
|
57 | |||
58 | void tst_QGroupedBarSeries::initTestCase() |
|
58 | void tst_QGroupedBarSeries::initTestCase() | |
@@ -66,7 +66,7 void tst_QGroupedBarSeries::cleanupTestCase() | |||||
66 |
|
66 | |||
67 | void tst_QGroupedBarSeries::init() |
|
67 | void tst_QGroupedBarSeries::init() | |
68 | { |
|
68 | { | |
69 |
m_barseries = new Q |
|
69 | m_barseries = new QBarSeries(); | |
70 | } |
|
70 | } | |
71 |
|
71 | |||
72 | void tst_QGroupedBarSeries::cleanup() |
|
72 | void tst_QGroupedBarSeries::cleanup() | |
@@ -81,7 +81,7 void tst_QGroupedBarSeries::qgroupedbarseries_data() | |||||
81 |
|
81 | |||
82 | void tst_QGroupedBarSeries::qgroupedbarseries() |
|
82 | void tst_QGroupedBarSeries::qgroupedbarseries() | |
83 | { |
|
83 | { | |
84 |
Q |
|
84 | QBarSeries *barseries = new QBarSeries(); | |
85 | QVERIFY(barseries != 0); |
|
85 | QVERIFY(barseries != 0); | |
86 | } |
|
86 | } | |
87 |
|
87 | |||
@@ -102,7 +102,7 void tst_QGroupedBarSeries::mouseclicked_data() | |||||
102 |
|
102 | |||
103 | void tst_QGroupedBarSeries::mouseclicked() |
|
103 | void tst_QGroupedBarSeries::mouseclicked() | |
104 | { |
|
104 | { | |
105 |
Q |
|
105 | QBarSeries* series = new QBarSeries(); | |
106 |
|
106 | |||
107 | QBarSet* set1 = new QBarSet(QString("set 1")); |
|
107 | QBarSet* set1 = new QBarSet(QString("set 1")); | |
108 | *set1 << 10 << 10 << 10; |
|
108 | *set1 << 10 << 10 << 10; | |
@@ -200,7 +200,7 void tst_QGroupedBarSeries::mousehovered_data() | |||||
200 |
|
200 | |||
201 | void tst_QGroupedBarSeries::mousehovered() |
|
201 | void tst_QGroupedBarSeries::mousehovered() | |
202 | { |
|
202 | { | |
203 |
Q |
|
203 | QBarSeries* series = new QBarSeries(); | |
204 |
|
204 | |||
205 | QBarSet* set1 = new QBarSet(QString("set 1")); |
|
205 | QBarSet* set1 = new QBarSet(QString("set 1")); | |
206 | *set1 << 10 << 10 << 10; |
|
206 | *set1 << 10 << 10 << 10; |
@@ -65,7 +65,7 QGroupBox *DataSerieDialog::seriesTypeSelector() | |||||
65 | layout->addWidget(line); |
|
65 | layout->addWidget(line); | |
66 | layout->addWidget(new QRadioButton("Area")); |
|
66 | layout->addWidget(new QRadioButton("Area")); | |
67 | layout->addWidget(new QRadioButton("Pie")); |
|
67 | layout->addWidget(new QRadioButton("Pie")); | |
68 |
layout->addWidget(new QRadioButton(" |
|
68 | layout->addWidget(new QRadioButton("Bar")); | |
69 | layout->addWidget(new QRadioButton("Stacked bar")); |
|
69 | layout->addWidget(new QRadioButton("Stacked bar")); | |
70 | layout->addWidget(new QRadioButton("Percent bar")); |
|
70 | layout->addWidget(new QRadioButton("Percent bar")); | |
71 | layout->addWidget(new QRadioButton("Scatter")); |
|
71 | layout->addWidget(new QRadioButton("Scatter")); |
@@ -27,7 +27,7 | |||||
27 | #include <qareaseries.h> |
|
27 | #include <qareaseries.h> | |
28 | #include <qsplineseries.h> |
|
28 | #include <qsplineseries.h> | |
29 | #include <qbarset.h> |
|
29 | #include <qbarset.h> | |
30 |
#include <q |
|
30 | #include <qbarseries.h> | |
31 | #include <qstackedbarseries.h> |
|
31 | #include <qstackedbarseries.h> | |
32 | #include <qpercentbarseries.h> |
|
32 | #include <qpercentbarseries.h> | |
33 | #include <QPushButton> |
|
33 | #include <QPushButton> | |
@@ -265,7 +265,7 void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS | |||||
265 | series->append(labels.at(i), column.at(i)); |
|
265 | series->append(labels.at(i), column.at(i)); | |
266 | m_chart->addSeries(series); |
|
266 | m_chart->addSeries(series); | |
267 | } |
|
267 | } | |
268 |
} else if (seriesName == " |
|
268 | } else if (seriesName == "Bar" | |
269 | || seriesName == "Stacked bar" |
|
269 | || seriesName == "Stacked bar" | |
270 | || seriesName == "Percent bar") { |
|
270 | || seriesName == "Percent bar") { | |
271 | QStringList category; |
|
271 | QStringList category; | |
@@ -273,8 +273,8 void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS | |||||
273 | foreach(QString label, labels) |
|
273 | foreach(QString label, labels) | |
274 | category << label; |
|
274 | category << label; | |
275 | QAbstractBarSeries* series = 0; |
|
275 | QAbstractBarSeries* series = 0; | |
276 |
if (seriesName == " |
|
276 | if (seriesName == "Bar") { | |
277 |
series = new Q |
|
277 | series = new QBarSeries(this); | |
278 | QCategoriesAxis* axis = new QCategoriesAxis(); |
|
278 | QCategoriesAxis* axis = new QCategoriesAxis(); | |
279 | axis->append(category); |
|
279 | axis->append(category); | |
280 | m_chart->setAxisX(axis,series); |
|
280 | m_chart->setAxisX(axis,series); |
General Comments 0
You need to be logged in to leave comments.
Login now