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