@@ -467,9 +467,6 QAbstractSeries *DeclarativeChart::createSeries(DeclarativeChart::SeriesType typ | |||||
467 | case DeclarativeChart::SeriesTypeArea: |
|
467 | case DeclarativeChart::SeriesTypeArea: | |
468 | series = new DeclarativeAreaSeries(); |
|
468 | series = new DeclarativeAreaSeries(); | |
469 | break; |
|
469 | break; | |
470 | case DeclarativeChart::SeriesTypeBar: |
|
|||
471 | series = new DeclarativeBarSeries(); |
|
|||
472 | break; |
|
|||
473 | case DeclarativeChart::SeriesTypeStackedBar: |
|
470 | case DeclarativeChart::SeriesTypeStackedBar: | |
474 | // TODO |
|
471 | // TODO | |
475 | break; |
|
472 | break; |
@@ -55,7 +55,6 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<DeclarativeBarSeries>(uri, 1, 0, "BarSeries"); |
|
|||
59 | qmlRegisterType<DeclarativeGroupedBarSeries>(uri, 1, 0, "GroupedBarSeries"); |
|
58 | qmlRegisterType<DeclarativeGroupedBarSeries>(uri, 1, 0, "GroupedBarSeries"); | |
60 | qmlRegisterType<DeclarativeStackedBarSeries>(uri, 1, 0, "StackedBarSeries"); |
|
59 | qmlRegisterType<DeclarativeStackedBarSeries>(uri, 1, 0, "StackedBarSeries"); | |
61 | qmlRegisterType<DeclarativePercentBarSeries>(uri, 1, 0, "PercentBarSeries"); |
|
60 | qmlRegisterType<DeclarativePercentBarSeries>(uri, 1, 0, "PercentBarSeries"); |
@@ -217,14 +217,6 QAbstractBarSeries::QAbstractBarSeries(QAbstractBarSeriesPrivate &d, QObject *pa | |||||
217 | } |
|
217 | } | |
218 |
|
218 | |||
219 | /*! |
|
219 | /*! | |
220 | Returns the type of series. Derived classes override this. |
|
|||
221 | */ |
|
|||
222 | QAbstractSeries::SeriesType QAbstractBarSeries::type() const |
|
|||
223 | { |
|
|||
224 | return QAbstractSeries::SeriesTypeBar; |
|
|||
225 | } |
|
|||
226 |
|
||||
227 | /*! |
|
|||
228 | 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 | |
229 | 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 | |
230 | 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. |
@@ -37,11 +37,13 class QTCOMMERCIALCHART_EXPORT QAbstractBarSeries : public QAbstractSeries | |||||
37 | Q_PROPERTY(int count READ count NOTIFY countChanged) |
|
37 | Q_PROPERTY(int count READ count NOTIFY countChanged) | |
38 | Q_PROPERTY(bool labelsVisible READ isLabelsVisible WRITE setLabelsVisible NOTIFY labelsVisibleChanged) |
|
38 | Q_PROPERTY(bool labelsVisible READ isLabelsVisible WRITE setLabelsVisible NOTIFY labelsVisibleChanged) | |
39 |
|
39 | |||
40 | public: |
|
40 | protected: | |
41 | explicit QAbstractBarSeries(QObject *parent = 0); |
|
41 | explicit QAbstractBarSeries(QObject *parent = 0); | |
|
42 | ||||
|
43 | public: | |||
42 | virtual ~QAbstractBarSeries(); |
|
44 | virtual ~QAbstractBarSeries(); | |
43 |
|
45 | |||
44 | QAbstractSeries::SeriesType type() const; |
|
46 | virtual QAbstractSeries::SeriesType type() const = 0; | |
45 |
|
47 | |||
46 | void setBarWidth(qreal width); |
|
48 | void setBarWidth(qreal width); | |
47 | qreal barWidth() const; |
|
49 | qreal barWidth() const; |
@@ -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 <qgroupedbarseries.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> | |
@@ -136,7 +136,7 void tst_ChartDataSet::addSeries_data() | |||||
136 | QAbstractSeries* scatter = new QScatterSeries(this); |
|
136 | QAbstractSeries* scatter = new QScatterSeries(this); | |
137 | QAbstractSeries* spline = new QSplineSeries(this); |
|
137 | QAbstractSeries* spline = new QSplineSeries(this); | |
138 | QAbstractSeries* pie = new QPieSeries(this); |
|
138 | QAbstractSeries* pie = new QPieSeries(this); | |
139 |
QAbstractSeries* bar = new Q |
|
139 | QAbstractSeries* bar = new QGroupedBarSeries(this); | |
140 | QAbstractSeries* percent = new QPercentBarSeries(this); |
|
140 | QAbstractSeries* percent = new QPercentBarSeries(this); | |
141 | QAbstractSeries* stacked = new QStackedBarSeries(this); |
|
141 | QAbstractSeries* stacked = new QStackedBarSeries(this); | |
142 |
|
142 | |||
@@ -185,7 +185,7 void tst_ChartDataSet::setAxisX_data() | |||||
185 | QAbstractSeries* scatter = new QScatterSeries(this); |
|
185 | QAbstractSeries* scatter = new QScatterSeries(this); | |
186 | QAbstractSeries* spline = new QSplineSeries(this); |
|
186 | QAbstractSeries* spline = new QSplineSeries(this); | |
187 | QAbstractSeries* pie = new QPieSeries(this); |
|
187 | QAbstractSeries* pie = new QPieSeries(this); | |
188 |
QAbstractSeries* bar = new Q |
|
188 | QAbstractSeries* bar = new QGroupedBarSeries(this); | |
189 | QAbstractSeries* percent = new QPercentBarSeries(this); |
|
189 | QAbstractSeries* percent = new QPercentBarSeries(this); | |
190 | QAbstractSeries* stacked = new QStackedBarSeries(this); |
|
190 | QAbstractSeries* stacked = new QStackedBarSeries(this); | |
191 |
|
191 |
@@ -19,7 +19,7 | |||||
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include <QtTest/QtTest> |
|
21 | #include <QtTest/QtTest> | |
22 |
#include <q |
|
22 | #include <qgroupedbarseries.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 | QGroupedBarSeries* m_barseries; | |
67 |
Q |
|
67 | QGroupedBarSeries* 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 QGroupedBarSeries(); | |
85 |
m_barseries_with_sets = new Q |
|
85 | m_barseries_with_sets = new QGroupedBarSeries(); | |
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 | QGroupedBarSeries *barseries = new QGroupedBarSeries(); | |
114 | QVERIFY(barseries != 0); |
|
114 | QVERIFY(barseries != 0); | |
115 | } |
|
115 | } | |
116 |
|
116 | |||
@@ -316,15 +316,13 void tst_QBarSeries::mouseclicked_data() | |||||
316 |
|
316 | |||
317 | void tst_QBarSeries::mouseclicked() |
|
317 | void tst_QBarSeries::mouseclicked() | |
318 | { |
|
318 | { | |
319 |
Q |
|
319 | QGroupedBarSeries* series = new QGroupedBarSeries(); | |
320 |
|
320 | |||
321 | QBarSet* set1 = new QBarSet(QString("set 1")); |
|
321 | QBarSet* set1 = new QBarSet(QString("set 1")); | |
322 | // *set1 << QPointF(0,10) << QPointF(1,10) << QPointF(2,10); |
|
|||
323 | *set1 << 10 << 10 << 10; |
|
322 | *set1 << 10 << 10 << 10; | |
324 | series->append(set1); |
|
323 | series->append(set1); | |
325 |
|
324 | |||
326 | QBarSet* set2 = new QBarSet(QString("set 2")); |
|
325 | QBarSet* set2 = new QBarSet(QString("set 2")); | |
327 | // *set2 << QPointF(0.3,10) << QPointF(1.3,10) << QPointF(2.3,10); |
|
|||
328 | *set2 << 10 << 10 << 10; |
|
326 | *set2 << 10 << 10 << 10; | |
329 | series->append(set2); |
|
327 | series->append(set2); | |
330 |
|
328 | |||
@@ -454,15 +452,13 void tst_QBarSeries::mousehovered_data() | |||||
454 |
|
452 | |||
455 | void tst_QBarSeries::mousehovered() |
|
453 | void tst_QBarSeries::mousehovered() | |
456 | { |
|
454 | { | |
457 |
Q |
|
455 | QGroupedBarSeries* series = new QGroupedBarSeries(); | |
458 |
|
456 | |||
459 | QBarSet* set1 = new QBarSet(QString("set 1")); |
|
457 | QBarSet* set1 = new QBarSet(QString("set 1")); | |
460 | // *set1 << QPointF(0,10) << QPointF(1,10) << QPointF(2,10); |
|
|||
461 | *set1 << 10 << 10 << 10; |
|
458 | *set1 << 10 << 10 << 10; | |
462 | series->append(set1); |
|
459 | series->append(set1); | |
463 |
|
460 | |||
464 | QBarSet* set2 = new QBarSet(QString("set 2")); |
|
461 | QBarSet* set2 = new QBarSet(QString("set 2")); | |
465 | // *set2 << QPointF(0.3,10) << QPointF(1.3,10) << QPointF(2.3,10); |
|
|||
466 | *set2 << 10 << 10 << 10; |
|
462 | *set2 << 10 << 10 << 10; | |
467 | series->append(set2); |
|
463 | series->append(set2); | |
468 |
|
464 | |||
@@ -550,15 +546,13 void tst_QBarSeries::mousehovered() | |||||
550 |
|
546 | |||
551 | void tst_QBarSeries::clearWithAnimations() |
|
547 | void tst_QBarSeries::clearWithAnimations() | |
552 | { |
|
548 | { | |
553 |
Q |
|
549 | QGroupedBarSeries* series = new QGroupedBarSeries(); | |
554 |
|
550 | |||
555 | QBarSet* set1 = new QBarSet(QString("set 1")); |
|
551 | QBarSet* set1 = new QBarSet(QString("set 1")); | |
556 | // *set1 << QPointF(0,10) << QPointF(1,10) << QPointF(2,10); |
|
|||
557 | *set1 << 10 << 10 << 10; |
|
552 | *set1 << 10 << 10 << 10; | |
558 | series->append(set1); |
|
553 | series->append(set1); | |
559 |
|
554 | |||
560 | QBarSet* set2 = new QBarSet(QString("set 2")); |
|
555 | QBarSet* set2 = new QBarSet(QString("set 2")); | |
561 | // *set2 << QPointF(0.3,10) << QPointF(1.3,10) << QPointF(2.3,10); |
|
|||
562 | *set2 << 10 << 10 << 10; |
|
556 | *set2 << 10 << 10 << 10; | |
563 | series->append(set2); |
|
557 | series->append(set2); | |
564 |
|
558 |
@@ -26,6 +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 <qgroupedbarseries.h> | |||
29 | #include <qpercentbarseries.h> |
|
30 | #include <qpercentbarseries.h> | |
30 | #include <qstackedbarseries.h> |
|
31 | #include <qstackedbarseries.h> | |
31 | #include <qvaluesaxis.h> |
|
32 | #include <qvaluesaxis.h> | |
@@ -177,7 +178,7 void tst_QChart::addSeries_data() | |||||
177 | QAbstractSeries* series2 = new QScatterSeries(this); |
|
178 | QAbstractSeries* series2 = new QScatterSeries(this); | |
178 | QAbstractSeries* series3 = new QSplineSeries(this); |
|
179 | QAbstractSeries* series3 = new QSplineSeries(this); | |
179 | QAbstractSeries* series4 = new QPieSeries(this); |
|
180 | QAbstractSeries* series4 = new QPieSeries(this); | |
180 |
QAbstractSeries* series5 = new Q |
|
181 | QAbstractSeries* series5 = new QGroupedBarSeries(this); | |
181 | QAbstractSeries* series6 = new QPercentBarSeries(this); |
|
182 | QAbstractSeries* series6 = new QPercentBarSeries(this); | |
182 | QAbstractSeries* series7 = new QStackedBarSeries(this); |
|
183 | QAbstractSeries* series7 = new QStackedBarSeries(this); | |
183 |
|
184 |
@@ -65,7 +65,6 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("Bar")); |
|
|||
69 | layout->addWidget(new QRadioButton("Grouped bar")); |
|
68 | layout->addWidget(new QRadioButton("Grouped bar")); | |
70 | layout->addWidget(new QRadioButton("Stacked bar")); |
|
69 | layout->addWidget(new QRadioButton("Stacked bar")); | |
71 | layout->addWidget(new QRadioButton("Percent bar")); |
|
70 | layout->addWidget(new QRadioButton("Percent bar")); |
@@ -27,7 +27,6 | |||||
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 <qabstractbarseries.h> |
|
|||
31 | #include <qgroupedbarseries.h> |
|
30 | #include <qgroupedbarseries.h> | |
32 | #include <qstackedbarseries.h> |
|
31 | #include <qstackedbarseries.h> | |
33 | #include <qpercentbarseries.h> |
|
32 | #include <qpercentbarseries.h> | |
@@ -266,8 +265,7 void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS | |||||
266 | series->append(labels.at(i), column.at(i)); |
|
265 | series->append(labels.at(i), column.at(i)); | |
267 | m_chart->addSeries(series); |
|
266 | m_chart->addSeries(series); | |
268 | } |
|
267 | } | |
269 |
} else if (seriesName == " |
|
268 | } else if (seriesName == "Grouped bar" | |
270 | || seriesName == "Grouped bar" |
|
|||
271 | || seriesName == "Stacked bar" |
|
269 | || seriesName == "Stacked bar" | |
272 | || seriesName == "Percent bar") { |
|
270 | || seriesName == "Percent bar") { | |
273 | QStringList category; |
|
271 | QStringList category; | |
@@ -275,12 +273,7 void MainWidget::addSeries(QString seriesName, int columnCount, int rowCount, QS | |||||
275 | foreach(QString label, labels) |
|
273 | foreach(QString label, labels) | |
276 | category << label; |
|
274 | category << label; | |
277 | QAbstractBarSeries* series = 0; |
|
275 | QAbstractBarSeries* series = 0; | |
278 |
if (seriesName == " |
|
276 | if (seriesName == "Grouped bar") { | |
279 | series = new QAbstractBarSeries(this); |
|
|||
280 | QCategoriesAxis* axis = new QCategoriesAxis(); |
|
|||
281 | axis->append(category); |
|
|||
282 | m_chart->setAxisX(axis,series); |
|
|||
283 | } else if (seriesName == "Grouped bar") { |
|
|||
284 | series = new QGroupedBarSeries(this); |
|
277 | series = new QGroupedBarSeries(this); | |
285 | QCategoriesAxis* axis = new QCategoriesAxis(); |
|
278 | QCategoriesAxis* axis = new QCategoriesAxis(); | |
286 | axis->append(category); |
|
279 | axis->append(category); |
General Comments 0
You need to be logged in to leave comments.
Login now