@@ -2,4 +2,5 TEMPLATE = subdirs | |||
|
2 | 2 | SUBDIRS += linechart \ |
|
3 | 3 | zoomlinechart \ |
|
4 | 4 | colorlinechart \ |
|
5 | barchart | |
|
5 | barchart \ | |
|
6 | stackedbarchart |
@@ -2,7 +2,6 | |||
|
2 | 2 | #define BARCHARTSERIES_H |
|
3 | 3 | |
|
4 | 4 | #include <QList> |
|
5 | //#include <QRectF> | |
|
6 | 5 | #include <QAbstractItemModel> |
|
7 | 6 | #include "qchartseries.h" |
|
8 | 7 | #include "qchartglobal.h" |
@@ -35,9 +34,6 public: | |||
|
35 | 34 | |
|
36 | 35 | public Q_SLOTS: |
|
37 | 36 | |
|
38 | // TODO: wrong place for this... series don't know anything about layout | |
|
39 | // void chartSizeChanged(QRectF rect); | |
|
40 | ||
|
41 | 37 | private: |
|
42 | 38 | |
|
43 | 39 | QAbstractItemModel* mModel; |
@@ -7,6 +7,8 | |||
|
7 | 7 | #include "qchartaxis.h" |
|
8 | 8 | #include "barchartseries.h" |
|
9 | 9 | #include "bargroup.h" |
|
10 | #include "stackedbarchartseries.h" | |
|
11 | #include "stackedbargroup.h" | |
|
10 | 12 | |
|
11 | 13 | #include "xylinechartitem_p.h" |
|
12 | 14 | #include "plotdomain_p.h" |
@@ -96,6 +98,23 void QChart::addSeries(QChartSeries* series) | |||
|
96 | 98 | childItems().append(barGroup); |
|
97 | 99 | break; |
|
98 | 100 | } |
|
101 | case QChartSeries::SeriesTypeStackedBar: { | |
|
102 | ||
|
103 | qDebug() << "barSeries added"; | |
|
104 | StackedBarChartSeries* stackedBarSeries = static_cast<StackedBarChartSeries*>(series); | |
|
105 | StackedBarGroup* stackedBarGroup = new StackedBarGroup(*stackedBarSeries,this); | |
|
106 | ||
|
107 | // Add some fugly colors for 5 fist series... | |
|
108 | stackedBarGroup->addColor(QColor(255,0,0,128)); | |
|
109 | stackedBarGroup->addColor(QColor(255,255,0,128)); | |
|
110 | stackedBarGroup->addColor(QColor(0,255,0,128)); | |
|
111 | stackedBarGroup->addColor(QColor(0,0,255,128)); | |
|
112 | stackedBarGroup->addColor(QColor(255,128,0,128)); | |
|
113 | ||
|
114 | m_chartItems<<stackedBarGroup; | |
|
115 | childItems().append(stackedBarGroup); | |
|
116 | break; | |
|
117 | } | |
|
99 | 118 | case QChartSeries::SeriesTypeScatter: { |
|
100 | 119 | QScatterSeries *scatterSeries = qobject_cast<QScatterSeries *>(series); |
|
101 | 120 | scatterSeries->d->setParentItem(this); |
@@ -141,6 +160,10 QChartSeries* QChart::createSeries(QChartSeries::QChartSeriesType type) | |||
|
141 | 160 | series = new BarChartSeries(this); |
|
142 | 161 | break; |
|
143 | 162 | } |
|
163 | case QChartSeries::SeriesTypeStackedBar: { | |
|
164 | series = new StackedBarChartSeries(this); | |
|
165 | break; | |
|
166 | } | |
|
144 | 167 | case QChartSeries::SeriesTypeScatter: { |
|
145 | 168 | series = new QScatterSeries(this); |
|
146 | 169 | break; |
@@ -15,6 +15,8 SOURCES += \ | |||
|
15 | 15 | barchart/barchartseries.cpp \ |
|
16 | 16 | barchart/bargroup.cpp \ |
|
17 | 17 | barchart/bar.cpp \ |
|
18 | barchart/stackedbarchartseries.cpp \ | |
|
19 | barchart/stackedbargroup.cpp \ | |
|
18 | 20 | xylinechart/qxychartseries.cpp \ |
|
19 | 21 | xylinechart/xylinechartitem.cpp \ |
|
20 | 22 | plotdomain.cpp \ |
@@ -26,9 +28,7 SOURCES += \ | |||
|
26 | 28 | pieslice.cpp \ |
|
27 | 29 | qchartview.cpp \ |
|
28 | 30 | qchartseries.cpp \ |
|
29 |
qchartaxis.cpp |
|
|
30 | barchart/stackedbarchartseries.cpp \ | |
|
31 | barchart/stackedbargroup.cpp | |
|
31 | qchartaxis.cpp | |
|
32 | 32 | |
|
33 | 33 | PRIVATE_HEADERS += \ |
|
34 | 34 | xylinechart/xylinechartitem_p.h \ |
@@ -48,12 +48,12 PUBLIC_HEADERS += \ | |||
|
48 | 48 | xylinechart/qxychartseries.h \ |
|
49 | 49 | barchart/barchartseries.h \ |
|
50 | 50 | barchart/bargroup.h \ |
|
51 | barchart/stackedbarchartseries.h \ | |
|
52 | barchart/stackedbargroup.h \ | |
|
51 | 53 | qchartview.h \ |
|
52 | 54 | qchartaxis.h |
|
53 | 55 | |
|
54 |
HEADERS += $$PUBLIC_HEADERS |
|
|
55 | barchart/stackedbarchartseries.h \ | |
|
56 | barchart/stackedbargroup.h | |
|
56 | HEADERS += $$PUBLIC_HEADERS | |
|
57 | 57 | HEADERS += $$PRIVATE_HEADERS |
|
58 | 58 | |
|
59 | 59 | INCLUDEPATH += xylinechart \ |
General Comments 0
You need to be logged in to leave comments.
Login now