@@ -0,0 +1,26 | |||||
|
1 | #include "qbarcategory.h" | |||
|
2 | ||||
|
3 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
4 | ||||
|
5 | QBarCategory::QBarCategory() | |||
|
6 | { | |||
|
7 | } | |||
|
8 | ||||
|
9 | QBarCategory& QBarCategory::operator << (const QString &label) | |||
|
10 | { | |||
|
11 | mList.append(label); | |||
|
12 | return *this; | |||
|
13 | } | |||
|
14 | ||||
|
15 | int QBarCategory::count() | |||
|
16 | { | |||
|
17 | return mList.count(); | |||
|
18 | } | |||
|
19 | ||||
|
20 | QList<QString>& QBarCategory::items() | |||
|
21 | { | |||
|
22 | return mList; | |||
|
23 | } | |||
|
24 | ||||
|
25 | ||||
|
26 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -0,0 +1,27 | |||||
|
1 | #ifndef QBARCATEGORY_H | |||
|
2 | #define QBARCATEGORY_H | |||
|
3 | ||||
|
4 | #include "qchartglobal.h" | |||
|
5 | ||||
|
6 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
7 | ||||
|
8 | class QTCOMMERCIALCHART_EXPORT QBarCategory // : pubclic QObject // TODO: Need for this? | |||
|
9 | { | |||
|
10 | public: | |||
|
11 | QBarCategory(); | |||
|
12 | ||||
|
13 | QBarCategory& operator << (const QString &label); | |||
|
14 | ||||
|
15 | // Number of items in category | |||
|
16 | int count(); | |||
|
17 | QList<QString>& items(); | |||
|
18 | ||||
|
19 | public: | |||
|
20 | ||||
|
21 | QList<QString> mList; | |||
|
22 | ||||
|
23 | }; | |||
|
24 | ||||
|
25 | QTCOMMERCIALCHART_END_NAMESPACE | |||
|
26 | ||||
|
27 | #endif // QBARCATEGORY_H |
@@ -0,0 +1,20 | |||||
|
1 | #include "qbarset.h" | |||
|
2 | ||||
|
3 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
4 | ||||
|
5 | QBarSet::QBarSet() | |||
|
6 | { | |||
|
7 | } | |||
|
8 | ||||
|
9 | void QBarSet::setName(QString name) | |||
|
10 | { | |||
|
11 | mName = name; | |||
|
12 | } | |||
|
13 | ||||
|
14 | QBarSet& QBarSet::operator << (const qreal &value) | |||
|
15 | { | |||
|
16 | mValues.append(value); | |||
|
17 | return *this; | |||
|
18 | } | |||
|
19 | ||||
|
20 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -0,0 +1,29 | |||||
|
1 | #ifndef QBARSET_H | |||
|
2 | #define QBARSET_H | |||
|
3 | ||||
|
4 | #include "qchartglobal.h" | |||
|
5 | ||||
|
6 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
7 | ||||
|
8 | class QTCOMMERCIALCHART_EXPORT QBarSet // : pubclic QObject // TODO: Need for this? | |||
|
9 | { | |||
|
10 | public: | |||
|
11 | QBarSet(); | |||
|
12 | ||||
|
13 | void setName(QString name); | |||
|
14 | // void setValues(QList<qreal> &values); | |||
|
15 | ||||
|
16 | // TODO: | |||
|
17 | QBarSet& operator << (const qreal &value); | |||
|
18 | ||||
|
19 | // TODO: Hide these from user of QBarSet. (but data model needs access to these) | |||
|
20 | public: | |||
|
21 | ||||
|
22 | QString mName; | |||
|
23 | QList<qreal> mValues; | |||
|
24 | ||||
|
25 | }; | |||
|
26 | ||||
|
27 | QTCOMMERCIALCHART_END_NAMESPACE | |||
|
28 | ||||
|
29 | #endif // QBARSET_H |
@@ -2,6 +2,8 | |||||
2 | #include <QMainWindow> |
|
2 | #include <QMainWindow> | |
3 | #include <QStandardItemModel> |
|
3 | #include <QStandardItemModel> | |
4 | #include <barchartseries.h> |
|
4 | #include <barchartseries.h> | |
|
5 | #include <qbarcategory.h> | |||
|
6 | #include <qbarset.h> | |||
5 | #include "chartwidget.h" |
|
7 | #include "chartwidget.h" | |
6 |
|
8 | |||
7 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
9 | QTCOMMERCIALCHART_USE_NAMESPACE | |
@@ -11,25 +13,29 int main(int argc, char *argv[]) | |||||
11 | QApplication a(argc, argv); |
|
13 | QApplication a(argc, argv); | |
12 | QMainWindow window; |
|
14 | QMainWindow window; | |
13 |
|
15 | |||
14 | BarChartSeries* series0 = new BarChartSeries(); |
|
16 | QBarCategory category; | |
|
17 | category << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "June" << "Jul" << "Aug" << "Sep" << "Nov" << "Dec"; | |||
|
18 | ||||
|
19 | BarChartSeries* series0 = new BarChartSeries(category); | |||
|
20 | ||||
|
21 | QBarSet barSet0; | |||
|
22 | QBarSet barSet1; | |||
|
23 | QBarSet barSet2; | |||
|
24 | QBarSet barSet3; | |||
|
25 | QBarSet barSet4; | |||
15 |
|
26 | |||
16 | // Create some test data to chart |
|
27 | // Create some test data to chart | |
17 | QList<qreal> data0; |
|
28 | barSet0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10; | |
18 |
|
|
29 | barSet1 << 5 << 0 << 0 << 4 << 0 << 7 << 8 << 9 << 9 << 0; | |
19 | QList<qreal> data1; |
|
30 | barSet2 << 3 << 5 << 8 << 13 << 8 << 5 << 3 << 2 << 1 << 1; | |
20 |
|
|
31 | barSet3 << 5 << 6 << 7 << 3 << 4 << 5 << 8 << 9 << 10 << 5; | |
21 | QList<qreal> data2; |
|
32 | barSet4 << 9 << 7 << 5 << 3 << 1 << 2 << 4 << 6 << 8 << 10; | |
22 | data2 << 3 << 5 << 8 << 13 << 8 << 5 << 3 << 2 << 1 << 1; |
|
33 | ||
23 | QList<qreal> data3; |
|
34 | series0->addBarSet(barSet0); | |
24 | data3 << 5 << 6 << 7 << 3 << 4 << 5 << 8 << 9 << 10 << 5; |
|
35 | series0->addBarSet(barSet1); | |
25 | QList<qreal> data4; |
|
36 | series0->addBarSet(barSet2); | |
26 | data4 << 9 << 7 << 5 << 3 << 1 << 2 << 4 << 6 << 8 << 10; |
|
37 | series0->addBarSet(barSet3); | |
27 |
|
38 | series0->addBarSet(barSet4); | ||
28 | series0->addData(data0); |
|
|||
29 | series0->addData(data1); |
|
|||
30 | series0->addData(data2); |
|
|||
31 | series0->addData(data3); |
|
|||
32 | series0->addData(data4); |
|
|||
33 |
|
39 | |||
34 | ChartWidget* chartWidget = new ChartWidget(&window); |
|
40 | ChartWidget* chartWidget = new ChartWidget(&window); | |
35 | chartWidget->addSeries(series0); |
|
41 | chartWidget->addSeries(series0); |
@@ -31,6 +31,10 int main(int argc, char *argv[]) | |||||
31 | series0->addData(data3); |
|
31 | series0->addData(data3); | |
32 | series0->addData(data4); |
|
32 | series0->addData(data4); | |
33 |
|
33 | |||
|
34 | QList<QString> labels; | |||
|
35 | labels << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "June" << "Jul" << "Aug" << "Sep" << "Nov" << "Dec"; | |||
|
36 | series0->setLabels(labels); | |||
|
37 | ||||
34 | ChartWidget* chartWidget = new ChartWidget(&window); |
|
38 | ChartWidget* chartWidget = new ChartWidget(&window); | |
35 | chartWidget->addSeries(series0); |
|
39 | chartWidget->addSeries(series0); | |
36 |
|
40 |
@@ -31,6 +31,10 int main(int argc, char *argv[]) | |||||
31 | series0->addData(data3); |
|
31 | series0->addData(data3); | |
32 | series0->addData(data4); |
|
32 | series0->addData(data4); | |
33 |
|
33 | |||
|
34 | QList<QString> labels; | |||
|
35 | labels << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "June" << "Jul" << "Aug" << "Sep" << "Nov" << "Dec"; | |||
|
36 | series0->setLabels(labels); | |||
|
37 | ||||
34 | ChartWidget* chartWidget = new ChartWidget(&window); |
|
38 | ChartWidget* chartWidget = new ChartWidget(&window); | |
35 | chartWidget->addSeries(series0); |
|
39 | chartWidget->addSeries(series0); | |
36 |
|
40 |
@@ -2,12 +2,15 | |||||
2 | #include <QVector> |
|
2 | #include <QVector> | |
3 | #include <QDebug> |
|
3 | #include <QDebug> | |
4 | #include "barchartmodel_p.h" |
|
4 | #include "barchartmodel_p.h" | |
|
5 | #include "qbarcategory.h" | |||
|
6 | #include "qbarset.h" | |||
5 |
|
7 | |||
6 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
7 |
|
9 | |||
8 | BarChartModel::BarChartModel(QObject *parent) : |
|
10 | BarChartModel::BarChartModel(QBarCategory &category, QObject *parent) : | |
9 | QObject(parent) |
|
11 | QObject(parent) | |
10 | ,mRunningId(1) |
|
12 | ,mRunningId(1) | |
|
13 | ,mCategory(category) | |||
11 | { |
|
14 | { | |
12 | } |
|
15 | } | |
13 |
|
16 | |||
@@ -41,6 +44,19 void BarChartModel::removeData(int id) | |||||
41 | emit modelUpdated(); |
|
44 | emit modelUpdated(); | |
42 | } |
|
45 | } | |
43 |
|
46 | |||
|
47 | void BarChartModel::addBarSet(QBarSet &set) | |||
|
48 | { | |||
|
49 | DataContainer* c = new DataContainer(set.mValues,mRunningId); | |||
|
50 | mDataModel.append(c); | |||
|
51 | mRunningId++; | |||
|
52 | } | |||
|
53 | ||||
|
54 | void BarChartModel::removeBarSet(QBarSet &set) | |||
|
55 | { | |||
|
56 | // TODO: | |||
|
57 | } | |||
|
58 | ||||
|
59 | ||||
44 | int BarChartModel::countRows() |
|
60 | int BarChartModel::countRows() | |
45 | { |
|
61 | { | |
46 | // qDebug() << "BarChartModel::countRows"; |
|
62 | // qDebug() << "BarChartModel::countRows"; |
@@ -9,17 +9,23 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
9 | // Model for bar chart. Internal class. |
|
9 | // Model for bar chart. Internal class. | |
10 | // TODO: Implement as QAbstractItemModel? |
|
10 | // TODO: Implement as QAbstractItemModel? | |
11 |
|
11 | |||
|
12 | class QBarSet; | |||
|
13 | class QBarCategory; | |||
|
14 | ||||
12 | class BarChartModel : public QObject //, public QAbstractItemModel |
|
15 | class BarChartModel : public QObject //, public QAbstractItemModel | |
13 | { |
|
16 | { | |
14 | Q_OBJECT |
|
17 | Q_OBJECT | |
15 | public: |
|
18 | public: | |
16 | explicit BarChartModel(QObject *parent = 0); |
|
19 | explicit BarChartModel(QBarCategory &category, QObject *parent = 0); | |
17 | ~BarChartModel(); |
|
20 | ~BarChartModel(); | |
18 |
|
21 | |||
19 | // Adds data to model. returns id. |
|
22 | // TODO: remove these after add and remove QBarSet works. | |
20 | int addData(QList<qreal> data); |
|
23 | int addData(QList<qreal> data); | |
21 | void removeData(int id); |
|
24 | void removeData(int id); | |
22 |
|
25 | |||
|
26 | void addBarSet(QBarSet &set); | |||
|
27 | void removeBarSet(QBarSet &set); | |||
|
28 | ||||
23 | int countRows(); // Number of series in model |
|
29 | int countRows(); // Number of series in model | |
24 | int countColumns(); // Maximum number of items in series |
|
30 | int countColumns(); // Maximum number of items in series | |
25 | int countTotalItems(); // Total items in all series. Includes empty items. |
|
31 | int countTotalItems(); // Total items in all series. Includes empty items. | |
@@ -54,6 +60,7 private: | |||||
54 | QList<DataContainer*> mDataModel; |
|
60 | QList<DataContainer*> mDataModel; | |
55 | int mRunningId; |
|
61 | int mRunningId; | |
56 | int mMaxColumns; // longest series in datamodel |
|
62 | int mMaxColumns; // longest series in datamodel | |
|
63 | QBarCategory& mCategory; | |||
57 |
|
64 | |||
58 | }; |
|
65 | }; | |
59 |
|
66 |
@@ -3,8 +3,8 | |||||
3 |
|
3 | |||
4 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
4 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
5 |
|
5 | |||
6 | BarChartSeries::BarChartSeries(QObject *parent) |
|
6 | BarChartSeries::BarChartSeries(QBarCategory &category, QObject *parent) | |
7 | : BarChartSeriesBase(parent) |
|
7 | : BarChartSeriesBase(category, parent) | |
8 | { |
|
8 | { | |
9 | } |
|
9 | } | |
10 |
|
10 |
@@ -14,7 +14,7 class QTCOMMERCIALCHART_EXPORT BarChartSeries : public BarChartSeriesBase | |||||
14 | { |
|
14 | { | |
15 | Q_OBJECT |
|
15 | Q_OBJECT | |
16 | public: |
|
16 | public: | |
17 | BarChartSeries(QObject* parent=0); |
|
17 | BarChartSeries(QBarCategory &category, QObject* parent=0); | |
18 |
|
18 | |||
19 | // from BarChartSeriesBase |
|
19 | // from BarChartSeriesBase | |
20 | virtual QChartSeriesType type() const { return QChartSeries::SeriesTypeBar; } |
|
20 | virtual QChartSeriesType type() const { return QChartSeries::SeriesTypeBar; } |
@@ -3,12 +3,13 | |||||
3 | #include "barchartseriesbase.h" |
|
3 | #include "barchartseriesbase.h" | |
4 | #include "bargroup.h" |
|
4 | #include "bargroup.h" | |
5 | #include "barchartmodel_p.h" |
|
5 | #include "barchartmodel_p.h" | |
|
6 | #include "qbarset.h" | |||
6 |
|
7 | |||
7 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
8 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
8 |
|
9 | |||
9 | BarChartSeriesBase::BarChartSeriesBase(QObject *parent) |
|
10 | BarChartSeriesBase::BarChartSeriesBase(QBarCategory &category, QObject *parent) | |
10 | : QChartSeries(parent) |
|
11 | : QChartSeries(parent) | |
11 | ,mModel(new BarChartModel(this)) |
|
12 | ,mModel(new BarChartModel(category, this)) | |
12 | { |
|
13 | { | |
13 | } |
|
14 | } | |
14 |
|
15 | |||
@@ -27,6 +28,16 void BarChartSeriesBase::setLabels(QList<QString> labels) | |||||
27 | mLabels = labels; |
|
28 | mLabels = labels; | |
28 | } |
|
29 | } | |
29 |
|
30 | |||
|
31 | void BarChartSeriesBase::addBarSet(QBarSet &set) | |||
|
32 | { | |||
|
33 | mModel->addBarSet(set); | |||
|
34 | } | |||
|
35 | ||||
|
36 | void BarChartSeriesBase::removeBarSet(QBarSet &set) | |||
|
37 | { | |||
|
38 | mModel->removeBarSet(set); | |||
|
39 | } | |||
|
40 | ||||
30 | qreal BarChartSeriesBase::min() |
|
41 | qreal BarChartSeriesBase::min() | |
31 | { |
|
42 | { | |
32 | return mModel->min(); |
|
43 | return mModel->min(); |
@@ -10,24 +10,30 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
10 |
|
10 | |||
11 | class BarGroupBase; |
|
11 | class BarGroupBase; | |
12 | class BarChartModel; |
|
12 | class BarChartModel; | |
|
13 | class QBarSet; | |||
|
14 | class QBarCategory; | |||
13 |
|
15 | |||
14 | // Container for series |
|
16 | // Container for series | |
15 | class QTCOMMERCIALCHART_EXPORT BarChartSeriesBase : public QChartSeries |
|
17 | class QTCOMMERCIALCHART_EXPORT BarChartSeriesBase : public QChartSeries | |
16 | { |
|
18 | { | |
17 | Q_OBJECT |
|
19 | Q_OBJECT | |
18 | protected: |
|
20 | protected: | |
19 | BarChartSeriesBase(QObject* parent=0); |
|
21 | // BarChartSeriesBase(QObject* parent=0); | |
|
22 | BarChartSeriesBase(QBarCategory &category, QObject* parent=0); | |||
20 |
|
23 | |||
21 | public: |
|
24 | public: | |
22 | // from QChartSeries |
|
25 | // from QChartSeries | |
23 | virtual QChartSeriesType type() const { return QChartSeries::SeriesTypeInvalid; } |
|
26 | virtual QChartSeriesType type() const { return QChartSeries::SeriesTypeInvalid; } | |
24 |
|
27 | |||
25 | // TODO: << operator for convinience |
|
28 | // TODO: These 3 will be removed. | |
26 | // Returns id for vector. |
|
|||
27 | int addData(QList<qreal> data); |
|
29 | int addData(QList<qreal> data); | |
28 | void removeData(int id); |
|
30 | void removeData(int id); | |
29 | void setLabels(QList<QString> labels); |
|
31 | void setLabels(QList<QString> labels); | |
30 |
|
32 | |||
|
33 | // TODO: Expose these to user in derived class instead of here? Common implementation for all bar charts, but not visible to user | |||
|
34 | void addBarSet(QBarSet &set); // Bob[1,5,6,2,15,4] first value goes to category 1 etc.. | |||
|
35 | void removeBarSet(QBarSet &set); // | |||
|
36 | ||||
31 | // These shouldn't be visible to chart series user. However, ChartDataSet needs to access them, and friends are evil. |
|
37 | // These shouldn't be visible to chart series user. However, ChartDataSet needs to access them, and friends are evil. | |
32 | qreal min(); |
|
38 | qreal min(); | |
33 | qreal max(); |
|
39 | qreal max(); | |
@@ -46,7 +52,6 public Q_SLOTS: | |||||
46 | private: |
|
52 | private: | |
47 |
|
53 | |||
48 | BarChartModel* mModel; |
|
54 | BarChartModel* mModel; | |
49 |
|
||||
50 | QList<QString> mLabels; |
|
55 | QList<QString> mLabels; | |
51 | }; |
|
56 | }; | |
52 |
|
57 |
@@ -13,7 +13,7 BarGroup::BarGroup(BarChartSeries& series, QGraphicsItem *parent) : | |||||
13 |
|
13 | |||
14 | void BarGroup::layoutChanged() |
|
14 | void BarGroup::layoutChanged() | |
15 | { |
|
15 | { | |
16 | qDebug() << "BarGroup::layoutChanged"; |
|
16 | // qDebug() << "BarGroup::layoutChanged"; | |
17 | // Scale bars to new layout |
|
17 | // Scale bars to new layout | |
18 | // Layout for bars: |
|
18 | // Layout for bars: | |
19 | if (mModel.countRows() <= 0) { |
|
19 | if (mModel.countRows() <= 0) { |
@@ -6,8 +6,8 | |||||
6 |
|
6 | |||
7 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
7 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
8 |
|
8 | |||
9 | PercentBarChartSeries::PercentBarChartSeries(QObject *parent) : |
|
9 | PercentBarChartSeries::PercentBarChartSeries(QBarCategory &category, QObject *parent) : | |
10 | BarChartSeriesBase(parent) |
|
10 | BarChartSeriesBase(category, parent) | |
11 | { |
|
11 | { | |
12 | } |
|
12 | } | |
13 |
|
13 |
@@ -13,7 +13,7 class QTCOMMERCIALCHART_EXPORT PercentBarChartSeries : public BarChartSeriesBase | |||||
13 | { |
|
13 | { | |
14 | Q_OBJECT |
|
14 | Q_OBJECT | |
15 | public: |
|
15 | public: | |
16 | PercentBarChartSeries(QObject* parent=0); |
|
16 | PercentBarChartSeries(QBarCategory &category, QObject* parent=0); | |
17 |
|
17 | |||
18 | // from BarChartSeriesBase |
|
18 | // from BarChartSeriesBase | |
19 | virtual QChartSeriesType type() const { return QChartSeries::SeriesTypePercentBar; } |
|
19 | virtual QChartSeriesType type() const { return QChartSeries::SeriesTypePercentBar; } |
@@ -4,8 +4,8 | |||||
4 |
|
4 | |||
5 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
5 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
6 |
|
6 | |||
7 | StackedBarChartSeries::StackedBarChartSeries(QObject *parent) : |
|
7 | StackedBarChartSeries::StackedBarChartSeries(QBarCategory &category, QObject *parent) : | |
8 | BarChartSeriesBase(parent) |
|
8 | BarChartSeriesBase(category, parent) | |
9 | { |
|
9 | { | |
10 | } |
|
10 | } | |
11 |
|
11 |
@@ -13,7 +13,7 class QTCOMMERCIALCHART_EXPORT StackedBarChartSeries : public BarChartSeriesBase | |||||
13 | { |
|
13 | { | |
14 | Q_OBJECT |
|
14 | Q_OBJECT | |
15 | public: |
|
15 | public: | |
16 | StackedBarChartSeries(QObject* parent=0); |
|
16 | StackedBarChartSeries(QBarCategory &category, QObject* parent=0); | |
17 |
|
17 | |||
18 | // from QChartSeries |
|
18 | // from QChartSeries | |
19 | virtual QChartSeriesType type() const { return QChartSeries::SeriesTypeStackedBar; } |
|
19 | virtual QChartSeriesType type() const { return QChartSeries::SeriesTypeStackedBar; } |
@@ -13,7 +13,7 StackedBarGroup::StackedBarGroup(StackedBarChartSeries& series, QGraphicsItem *p | |||||
13 |
|
13 | |||
14 | void StackedBarGroup::layoutChanged() |
|
14 | void StackedBarGroup::layoutChanged() | |
15 | { |
|
15 | { | |
16 | qDebug() << "StackedBarGroup::layoutChanged"; |
|
16 | // qDebug() << "StackedBarGroup::layoutChanged"; | |
17 | // Scale bars to new layout |
|
17 | // Scale bars to new layout | |
18 | // Layout for bars: |
|
18 | // Layout for bars: | |
19 | if (mModel.countRows() <= 0) { |
|
19 | if (mModel.countRows() <= 0) { |
@@ -44,15 +44,15 QChartSeries* QChart::createSeries(QChartSeries::QChartSeriesType type) | |||||
44 | break; |
|
44 | break; | |
45 | } |
|
45 | } | |
46 | case QChartSeries::SeriesTypeBar: { |
|
46 | case QChartSeries::SeriesTypeBar: { | |
47 | series = new BarChartSeries(this); |
|
47 | //series = new BarChartSeries(this); | |
48 | break; |
|
48 | break; | |
49 | } |
|
49 | } | |
50 | case QChartSeries::SeriesTypeStackedBar: { |
|
50 | case QChartSeries::SeriesTypeStackedBar: { | |
51 | series = new StackedBarChartSeries(this); |
|
51 | //series = new StackedBarChartSeries(this); | |
52 | break; |
|
52 | break; | |
53 | } |
|
53 | } | |
54 | case QChartSeries::SeriesTypePercentBar: { |
|
54 | case QChartSeries::SeriesTypePercentBar: { | |
55 | series = new PercentBarChartSeries(this); |
|
55 | //series = new PercentBarChartSeries(this); | |
56 | break; |
|
56 | break; | |
57 | } |
|
57 | } | |
58 | case QChartSeries::SeriesTypeScatter: { |
|
58 | case QChartSeries::SeriesTypeScatter: { |
@@ -18,6 +18,8 SOURCES += barchart/barchartseries.cpp \ | |||||
18 | barchart/separator.cpp \ |
|
18 | barchart/separator.cpp \ | |
19 | barchart/bargroupbase.cpp \ |
|
19 | barchart/bargroupbase.cpp \ | |
20 | barchart/barchartseriesbase.cpp \ |
|
20 | barchart/barchartseriesbase.cpp \ | |
|
21 | barchart/qbarset.cpp \ | |||
|
22 | barchart/qbarcategory.cpp \ | |||
21 | linechart/linechartanimationitem.cpp \ |
|
23 | linechart/linechartanimationitem.cpp \ | |
22 | linechart/linechartitem.cpp \ |
|
24 | linechart/linechartitem.cpp \ | |
23 | linechart/qlinechartseries.cpp \ |
|
25 | linechart/qlinechartseries.cpp \ | |
@@ -56,6 +58,8 PUBLIC_HEADERS += linechart/qlinechartseries.h \ | |||||
56 | barchart/percentbargroup.h \ |
|
58 | barchart/percentbargroup.h \ | |
57 | barchart/barchartseriesbase.h \ |
|
59 | barchart/barchartseriesbase.h \ | |
58 | barchart/bargroupbase.h \ |
|
60 | barchart/bargroupbase.h \ | |
|
61 | barchart/qbarset.h \ | |||
|
62 | barchart/qbarcategory.h \ | |||
59 | qchartseries.h \ |
|
63 | qchartseries.h \ | |
60 | qscatterseries.h \ |
|
64 | qscatterseries.h \ | |
61 | qchart.h \ |
|
65 | qchart.h \ |
@@ -211,11 +211,11 void MainWidget::addSeries(QString series, QString data) | |||||
211 | } |
|
211 | } | |
212 | } else if (data == "Table, 5 series"){ |
|
212 | } else if (data == "Table, 5 series"){ | |
213 | // Create some test data to chart |
|
213 | // Create some test data to chart | |
214 | data0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10; |
|
214 | data0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10 << 5; | |
215 | data1 << 5 << 0 << 0 << 4 << 0 << 7 << 8 << 9 << 9 << 0; |
|
215 | data1 << 5 << 0 << 0 << 4 << 0 << 7 << 8 << 9 << 9 << 0 << 4; | |
216 | data2 << 3 << 5 << 8 << 13 << 8 << 5 << 3 << 2 << 1 << 1; |
|
216 | data2 << 3 << 5 << 8 << 13 << 8 << 5 << 3 << 2 << 1 << 1 << 3; | |
217 | data3 << 5 << 6 << 7 << 3 << 4 << 5 << 8 << 9 << 10 << 5; |
|
217 | data3 << 5 << 6 << 7 << 3 << 4 << 5 << 8 << 9 << 10 << 5 << 2; | |
218 | data4 << 9 << 7 << 5 << 3 << 1 << 2 << 4 << 6 << 8 << 10; |
|
218 | data4 << 9 << 7 << 5 << 3 << 1 << 2 << 4 << 6 << 8 << 10 << 1; | |
219 | } else { |
|
219 | } else { | |
220 | // TODO: check if data has a valid file name |
|
220 | // TODO: check if data has a valid file name | |
221 | Q_ASSERT(false); |
|
221 | Q_ASSERT(false); |
General Comments 0
You need to be logged in to leave comments.
Login now