@@ -1,30 +1,30 | |||||
1 | INCLUDEPATH += $$PWD |
|
1 | INCLUDEPATH += $$PWD | |
2 | DEPENDPATH += $$PWD |
|
2 | DEPENDPATH += $$PWD | |
3 |
|
3 | |||
4 | SOURCES += \ |
|
4 | SOURCES += \ | |
5 | $$PWD/chartaxis.cpp \ |
|
5 | $$PWD/chartaxis.cpp \ | |
6 | $$PWD/chartvaluesaxisx.cpp \ |
|
6 | $$PWD/chartvaluesaxisx.cpp \ | |
7 | $$PWD/chartvaluesaxisy.cpp \ |
|
7 | $$PWD/chartvaluesaxisy.cpp \ | |
8 | $$PWD/chartcategoriesaxisx.cpp \ |
|
8 | $$PWD/chartcategoriesaxisx.cpp \ | |
9 | $$PWD/chartcategoriesaxisy.cpp \ |
|
9 | $$PWD/chartcategoriesaxisy.cpp \ | |
10 | $$PWD/qbarcategoriesaxis.cpp \ |
|
10 | $$PWD/qbarcategoriesaxis.cpp \ | |
11 |
$$PWD/q |
|
11 | $$PWD/qintervalaxis.cpp \ | |
12 | $$PWD/qvaluesaxis.cpp \ |
|
12 | $$PWD/qvaluesaxis.cpp \ | |
13 | $$PWD/qabstractaxis.cpp |
|
13 | $$PWD/qabstractaxis.cpp | |
14 |
|
14 | |||
15 | PRIVATE_HEADERS += \ |
|
15 | PRIVATE_HEADERS += \ | |
16 | $$PWD/chartaxis_p.h \ |
|
16 | $$PWD/chartaxis_p.h \ | |
17 | $$PWD/chartvaluesaxisx_p.h \ |
|
17 | $$PWD/chartvaluesaxisx_p.h \ | |
18 | $$PWD/chartvaluesaxisy_p.h \ |
|
18 | $$PWD/chartvaluesaxisy_p.h \ | |
19 | $$PWD/chartcategoriesaxisx_p.h \ |
|
19 | $$PWD/chartcategoriesaxisx_p.h \ | |
20 | $$PWD/chartcategoriesaxisy_p.h \ |
|
20 | $$PWD/chartcategoriesaxisy_p.h \ | |
21 | $$PWD/qbarcategoriesaxis_p.h \ |
|
21 | $$PWD/qbarcategoriesaxis_p.h \ | |
22 |
$$PWD/q |
|
22 | $$PWD/qintervalaxis_p.h \ | |
23 | $$PWD/qvaluesaxis_p.h \ |
|
23 | $$PWD/qvaluesaxis_p.h \ | |
24 | $$PWD/qabstractaxis_p.h |
|
24 | $$PWD/qabstractaxis_p.h | |
25 |
|
25 | |||
26 | PUBLIC_HEADERS += \ |
|
26 | PUBLIC_HEADERS += \ | |
27 | $$PWD/qbarcategoriesaxis.h \ |
|
27 | $$PWD/qbarcategoriesaxis.h \ | |
28 |
$$PWD/q |
|
28 | $$PWD/qintervalaxis.h \ | |
29 | $$PWD/qvaluesaxis.h \ |
|
29 | $$PWD/qvaluesaxis.h \ | |
30 | $$PWD/qabstractaxis.h |
|
30 | $$PWD/qabstractaxis.h |
@@ -1,149 +1,149 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 |
#include "q |
|
21 | #include "qintervalaxis.h" | |
22 |
#include "q |
|
22 | #include "qintervalaxis_p.h" | |
23 | #include "chartcategoriesaxisx_p.h" |
|
23 | #include "chartcategoriesaxisx_p.h" | |
24 | #include "chartcategoriesaxisy_p.h" |
|
24 | #include "chartcategoriesaxisy_p.h" | |
25 | #include <qmath.h> |
|
25 | #include <qmath.h> | |
26 | #include <QDebug> |
|
26 | #include <QDebug> | |
27 |
|
27 | |||
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
29 |
|
29 | |||
30 | QIntervalAxis::QIntervalAxis(QObject *parent): |
|
30 | QIntervalAxis::QIntervalAxis(QObject *parent): | |
31 | QValuesAxis(*new QIntervalAxisPrivate(this),parent) |
|
31 | QValuesAxis(*new QIntervalAxisPrivate(this),parent) | |
32 | { |
|
32 | { | |
33 | } |
|
33 | } | |
34 |
|
34 | |||
35 | QIntervalAxis::~QIntervalAxis() |
|
35 | QIntervalAxis::~QIntervalAxis() | |
36 | { |
|
36 | { | |
37 | } |
|
37 | } | |
38 |
|
38 | |||
39 | QIntervalAxis::QIntervalAxis(QIntervalAxisPrivate &d,QObject *parent):QValuesAxis(d,parent) |
|
39 | QIntervalAxis::QIntervalAxis(QIntervalAxisPrivate &d,QObject *parent):QValuesAxis(d,parent) | |
40 | { |
|
40 | { | |
41 |
|
41 | |||
42 | } |
|
42 | } | |
43 |
|
43 | |||
44 | /*! |
|
44 | /*! | |
45 | Appends \a categories to axis |
|
45 | Appends \a categories to axis | |
46 | */ |
|
46 | */ | |
47 | void QIntervalAxis::append(const QString& category, qreal x) |
|
47 | void QIntervalAxis::append(const QString& category, qreal x) | |
48 | { |
|
48 | { | |
49 | Q_D(QIntervalAxis); |
|
49 | Q_D(QIntervalAxis); | |
50 | if (!d->m_categories.contains(category)) |
|
50 | if (!d->m_categories.contains(category)) | |
51 | { |
|
51 | { | |
52 | if(d->m_categories.isEmpty()){ |
|
52 | if(d->m_categories.isEmpty()){ | |
53 | Range range(d->m_categoryMinimum,x); |
|
53 | Range range(d->m_categoryMinimum,x); | |
54 | d->m_categoriesMap.insert(category,range); |
|
54 | d->m_categoriesMap.insert(category,range); | |
55 | d->m_categories.append(category); |
|
55 | d->m_categories.append(category); | |
56 | }else{ |
|
56 | }else{ | |
57 | Range range = d->m_categoriesMap.value(d->m_categories.last()); |
|
57 | Range range = d->m_categoriesMap.value(d->m_categories.last()); | |
58 | d->m_categoriesMap.insert(category,Range(range.first,x)); |
|
58 | d->m_categoriesMap.insert(category,Range(range.first,x)); | |
59 | d->m_categories.append(category); |
|
59 | d->m_categories.append(category); | |
60 | } |
|
60 | } | |
61 | setRange(d->m_min,x); |
|
61 | setRange(d->m_min,x); | |
62 | } |
|
62 | } | |
63 | } |
|
63 | } | |
64 |
|
64 | |||
65 | void QIntervalAxis::setFisrtCategoryMinimum(qreal x) |
|
65 | void QIntervalAxis::setFisrtCategoryMinimum(qreal x) | |
66 | { |
|
66 | { | |
67 | Q_D(QIntervalAxis); |
|
67 | Q_D(QIntervalAxis); | |
68 | if(d->m_categories.isEmpty()){ |
|
68 | if(d->m_categories.isEmpty()){ | |
69 | d->m_categoryMinimum=x; |
|
69 | d->m_categoryMinimum=x; | |
70 | }else{ |
|
70 | }else{ | |
71 | Range range = d->m_categoriesMap.value(d->m_categories.first()); |
|
71 | Range range = d->m_categoriesMap.value(d->m_categories.first()); | |
72 | d->m_categoriesMap.insert(d->m_categories.first(),Range(x,range.second)); |
|
72 | d->m_categoriesMap.insert(d->m_categories.first(),Range(x,range.second)); | |
73 | setRange(x,d->m_min); |
|
73 | setRange(x,d->m_min); | |
74 | } |
|
74 | } | |
75 | } |
|
75 | } | |
76 |
|
76 | |||
77 | /*! |
|
77 | /*! | |
78 | Removes \a category from axis |
|
78 | Removes \a category from axis | |
79 | */ |
|
79 | */ | |
80 | void QIntervalAxis::remove(const QString &category) |
|
80 | void QIntervalAxis::remove(const QString &category) | |
81 | { |
|
81 | { | |
82 | Q_UNUSED(category); |
|
82 | Q_UNUSED(category); | |
83 | //TODO |
|
83 | //TODO | |
84 | } |
|
84 | } | |
85 |
|
85 | |||
86 | QStringList QIntervalAxis::categories() |
|
86 | QStringList QIntervalAxis::categories() | |
87 | { |
|
87 | { | |
88 | Q_D(QIntervalAxis); |
|
88 | Q_D(QIntervalAxis); | |
89 | return d->m_categories; |
|
89 | return d->m_categories; | |
90 | } |
|
90 | } | |
91 |
|
91 | |||
92 | /*! |
|
92 | /*! | |
93 | Returns number of categories. |
|
93 | Returns number of categories. | |
94 | */ |
|
94 | */ | |
95 | int QIntervalAxis::count() const |
|
95 | int QIntervalAxis::count() const | |
96 | { |
|
96 | { | |
97 | Q_D(const QIntervalAxis); |
|
97 | Q_D(const QIntervalAxis); | |
98 | return d->m_categories.count(); |
|
98 | return d->m_categories.count(); | |
99 | } |
|
99 | } | |
100 |
|
100 | |||
101 | /*! |
|
101 | /*! | |
102 | Returns the type of axis. |
|
102 | Returns the type of axis. | |
103 | */ |
|
103 | */ | |
104 | QAbstractAxis::AxisType QIntervalAxis::type() const |
|
104 | QAbstractAxis::AxisType QIntervalAxis::type() const | |
105 | { |
|
105 | { | |
106 | return AxisTypeCategories; |
|
106 | return AxisTypeCategories; | |
107 | } |
|
107 | } | |
108 |
|
108 | |||
109 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
109 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
110 |
|
110 | |||
111 | QIntervalAxisPrivate::QIntervalAxisPrivate(QIntervalAxis* q): |
|
111 | QIntervalAxisPrivate::QIntervalAxisPrivate(QIntervalAxis* q): | |
112 | QValuesAxisPrivate(q), |
|
112 | QValuesAxisPrivate(q), | |
113 | m_categoryMinimum(0) |
|
113 | m_categoryMinimum(0) | |
114 | { |
|
114 | { | |
115 |
|
115 | |||
116 | } |
|
116 | } | |
117 |
|
117 | |||
118 | QIntervalAxisPrivate::~QIntervalAxisPrivate() |
|
118 | QIntervalAxisPrivate::~QIntervalAxisPrivate() | |
119 | { |
|
119 | { | |
120 |
|
120 | |||
121 | } |
|
121 | } | |
122 |
|
122 | |||
123 | int QIntervalAxisPrivate::ticksCount() const |
|
123 | int QIntervalAxisPrivate::ticksCount() const | |
124 | { |
|
124 | { | |
125 | return m_categories.count()+1; |
|
125 | return m_categories.count()+1; | |
126 | } |
|
126 | } | |
127 |
|
127 | |||
128 | void QIntervalAxisPrivate::handleAxisRangeChanged(qreal min, qreal max,int count) |
|
128 | void QIntervalAxisPrivate::handleAxisRangeChanged(qreal min, qreal max,int count) | |
129 | { |
|
129 | { | |
130 | m_min = min; |
|
130 | m_min = min; | |
131 | m_max = max; |
|
131 | m_max = max; | |
132 | m_ticksCount = count; |
|
132 | m_ticksCount = count; | |
133 | } |
|
133 | } | |
134 |
|
134 | |||
135 | ChartAxis* QIntervalAxisPrivate::createGraphics(ChartPresenter* presenter) |
|
135 | ChartAxis* QIntervalAxisPrivate::createGraphics(ChartPresenter* presenter) | |
136 | { |
|
136 | { | |
137 | Q_UNUSED(presenter); |
|
137 | Q_UNUSED(presenter); | |
138 | // Q_Q( QCategoriesAxis); |
|
138 | // Q_Q( QCategoriesAxis); | |
139 | if(m_orientation == Qt::Vertical){ |
|
139 | if(m_orientation == Qt::Vertical){ | |
140 | return 0; |
|
140 | return 0; | |
141 | }else{ |
|
141 | }else{ | |
142 | return 0; |
|
142 | return 0; | |
143 | } |
|
143 | } | |
144 | } |
|
144 | } | |
145 |
|
145 | |||
146 |
#include "moc_q |
|
146 | #include "moc_qintervalaxis.cpp" | |
147 |
#include "moc_q |
|
147 | #include "moc_qintervalaxis_p.cpp" | |
148 |
|
148 | |||
149 | QTCOMMERCIALCHART_END_NAMESPACE |
|
149 | QTCOMMERCIALCHART_END_NAMESPACE |
1 | NO CONTENT: file renamed from src/axis/qcategoriesaxis.h to src/axis/qintervalaxis.h |
|
NO CONTENT: file renamed from src/axis/qcategoriesaxis.h to src/axis/qintervalaxis.h |
@@ -1,71 +1,71 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | // W A R N I N G |
|
21 | // W A R N I N G | |
22 | // ------------- |
|
22 | // ------------- | |
23 | // |
|
23 | // | |
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
25 | // implementation detail. This header file may change from version to |
|
25 | // implementation detail. This header file may change from version to | |
26 | // version without notice, or even be removed. |
|
26 | // version without notice, or even be removed. | |
27 | // |
|
27 | // | |
28 | // We mean it. |
|
28 | // We mean it. | |
29 |
|
29 | |||
30 |
#ifndef Q |
|
30 | #ifndef QINTERVALAXIS_P_H | |
31 |
#define Q |
|
31 | #define QINTERVALAXIS_P_H | |
32 |
|
32 | |||
33 |
#include "q |
|
33 | #include "qintervalaxis.h" | |
34 | #include "qvaluesaxis_p.h" |
|
34 | #include "qvaluesaxis_p.h" | |
35 |
|
35 | |||
36 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
36 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
37 |
|
37 | |||
38 |
|
38 | |||
39 | typedef QPair<qreal, qreal> Range; |
|
39 | typedef QPair<qreal, qreal> Range; | |
40 |
|
40 | |||
41 | class QIntervalAxisPrivate : public QValuesAxisPrivate |
|
41 | class QIntervalAxisPrivate : public QValuesAxisPrivate | |
42 | { |
|
42 | { | |
43 | Q_OBJECT |
|
43 | Q_OBJECT | |
44 |
|
44 | |||
45 | public: |
|
45 | public: | |
46 | QIntervalAxisPrivate(QIntervalAxis *q); |
|
46 | QIntervalAxisPrivate(QIntervalAxis *q); | |
47 | ~QIntervalAxisPrivate(); |
|
47 | ~QIntervalAxisPrivate(); | |
48 |
|
48 | |||
49 |
|
49 | |||
50 | public: |
|
50 | public: | |
51 | ChartAxis* createGraphics(ChartPresenter* presenter); |
|
51 | ChartAxis* createGraphics(ChartPresenter* presenter); | |
52 | int ticksCount() const; |
|
52 | int ticksCount() const; | |
53 |
|
53 | |||
54 | Q_SIGNALS: |
|
54 | Q_SIGNALS: | |
55 | void changed(qreal min, qreal max, int tickCount,bool niceNumbers); |
|
55 | void changed(qreal min, qreal max, int tickCount,bool niceNumbers); | |
56 |
|
56 | |||
57 | public Q_SLOTS: |
|
57 | public Q_SLOTS: | |
58 | void handleAxisRangeChanged(qreal min, qreal max,int count); |
|
58 | void handleAxisRangeChanged(qreal min, qreal max,int count); | |
59 |
|
59 | |||
60 | private: |
|
60 | private: | |
61 | QMap<QString , Range> m_categoriesMap; |
|
61 | QMap<QString , Range> m_categoriesMap; | |
62 | QStringList m_categories; |
|
62 | QStringList m_categories; | |
63 | qreal m_categoryMinimum; |
|
63 | qreal m_categoryMinimum; | |
64 |
|
64 | |||
65 | private: |
|
65 | private: | |
66 | Q_DECLARE_PUBLIC(QIntervalAxis) |
|
66 | Q_DECLARE_PUBLIC(QIntervalAxis) | |
67 | }; |
|
67 | }; | |
68 |
|
68 | |||
69 | QTCOMMERCIALCHART_END_NAMESPACE |
|
69 | QTCOMMERCIALCHART_END_NAMESPACE | |
70 |
|
70 | |||
71 | #endif // QCATEGORIESAXIS_P_H |
|
71 | #endif // QCATEGORIESAXIS_P_H |
@@ -1,119 +1,118 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include "qbarseries.h" |
|
21 | #include "qbarseries.h" | |
22 | #include "qbarseries_p.h" |
|
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" | |
26 | #include "chartanimator_p.h" |
|
26 | #include "chartanimator_p.h" | |
27 | #include "qcategoriesaxis.h" |
|
|||
28 | #include "qvaluesaxis.h" |
|
27 | #include "qvaluesaxis.h" | |
29 |
|
28 | |||
30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
31 |
|
30 | |||
32 | /*! |
|
31 | /*! | |
33 | \class QBarSeries |
|
32 | \class QBarSeries | |
34 | \brief Series for creating bar chart |
|
33 | \brief Series for creating bar chart | |
35 | \mainclass |
|
34 | \mainclass | |
36 |
|
35 | |||
37 | QBarSeries represents a series of data shown as bars. The purpose of this class is to draw bars |
|
36 | 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 |
|
37 | 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. |
|
38 | from sets to categories, which are defined by a QStringList. | |
40 |
|
39 | |||
41 | See the \l {GroupedbarChart Example} {grouped bar chart example} to learn how to create a grouped bar chart. |
|
40 | See the \l {GroupedbarChart Example} {grouped bar chart example} to learn how to create a grouped bar chart. | |
42 | \image examples_groupedbarchart.png |
|
41 | \image examples_groupedbarchart.png | |
43 |
|
42 | |||
44 | \sa QBarSet, QPercentBarSeries, QAbstractBarSeries, QStackedBarSeries |
|
43 | \sa QBarSet, QPercentBarSeries, QAbstractBarSeries, QStackedBarSeries | |
45 | */ |
|
44 | */ | |
46 | /*! |
|
45 | /*! | |
47 | \qmlclass BarSeries QBarSeries |
|
46 | \qmlclass BarSeries QBarSeries | |
48 | \inherits AbstractBarSeries |
|
47 | \inherits AbstractBarSeries | |
49 |
|
48 | |||
50 | The following QML shows how to create a simple grouped bar chart: |
|
49 | The following QML shows how to create a simple grouped bar chart: | |
51 | \snippet ../demos/qmlchart/qml/qmlchart/View8.qml 1 |
|
50 | \snippet ../demos/qmlchart/qml/qmlchart/View8.qml 1 | |
52 | \beginfloatleft |
|
51 | \beginfloatleft | |
53 | \image demos_qmlchart7.png |
|
52 | \image demos_qmlchart7.png | |
54 | \endfloat |
|
53 | \endfloat | |
55 | \clearfloat |
|
54 | \clearfloat | |
56 | */ |
|
55 | */ | |
57 |
|
56 | |||
58 | /*! |
|
57 | /*! | |
59 | Constructs empty QBarSeries. |
|
58 | Constructs empty QBarSeries. | |
60 | QBarSeries is QObject which is a child of a \a parent. |
|
59 | QBarSeries is QObject which is a child of a \a parent. | |
61 | */ |
|
60 | */ | |
62 | QBarSeries::QBarSeries(QObject *parent) |
|
61 | QBarSeries::QBarSeries(QObject *parent) | |
63 | : QAbstractBarSeries(*new QBarSeriesPrivate(this), parent) |
|
62 | : QAbstractBarSeries(*new QBarSeriesPrivate(this), parent) | |
64 | { |
|
63 | { | |
65 | } |
|
64 | } | |
66 |
|
65 | |||
67 | /*! |
|
66 | /*! | |
68 | Returns QChartSeries::SeriesTypeGroupedBar. |
|
67 | Returns QChartSeries::SeriesTypeGroupedBar. | |
69 | */ |
|
68 | */ | |
70 | QAbstractSeries::SeriesType QBarSeries::type() const |
|
69 | QAbstractSeries::SeriesType QBarSeries::type() const | |
71 | { |
|
70 | { | |
72 | return QAbstractSeries::SeriesTypeBar; |
|
71 | return QAbstractSeries::SeriesTypeBar; | |
73 | } |
|
72 | } | |
74 |
|
73 | |||
75 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
74 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
76 |
|
75 | |||
77 | QBarSeriesPrivate::QBarSeriesPrivate(QBarSeries *q) : QAbstractBarSeriesPrivate(q) |
|
76 | QBarSeriesPrivate::QBarSeriesPrivate(QBarSeries *q) : QAbstractBarSeriesPrivate(q) | |
78 | { |
|
77 | { | |
79 |
|
78 | |||
80 | } |
|
79 | } | |
81 |
|
80 | |||
82 | void QBarSeriesPrivate::scaleDomain(Domain& domain) |
|
81 | void QBarSeriesPrivate::scaleDomain(Domain& domain) | |
83 | { |
|
82 | { | |
84 | qreal minX(domain.minX()); |
|
83 | qreal minX(domain.minX()); | |
85 | qreal minY(domain.minY()); |
|
84 | qreal minY(domain.minY()); | |
86 | qreal maxX(domain.maxX()); |
|
85 | qreal maxX(domain.maxX()); | |
87 | qreal maxY(domain.maxY()); |
|
86 | qreal maxY(domain.maxY()); | |
88 | int tickXCount(domain.tickXCount()); |
|
87 | int tickXCount(domain.tickXCount()); | |
89 | int tickYCount(domain.tickYCount()); |
|
88 | int tickYCount(domain.tickYCount()); | |
90 |
|
89 | |||
91 | qreal x = categoryCount(); |
|
90 | qreal x = categoryCount(); | |
92 | qreal y = max(); |
|
91 | qreal y = max(); | |
93 | minX = qMin(minX, -0.5); |
|
92 | minX = qMin(minX, -0.5); | |
94 | minY = qMin(minY, y); |
|
93 | minY = qMin(minY, y); | |
95 | maxX = qMax(maxX, x - 0.5); |
|
94 | maxX = qMax(maxX, x - 0.5); | |
96 | maxY = qMax(maxY, y); |
|
95 | maxY = qMax(maxY, y); | |
97 | tickXCount = x+1; |
|
96 | tickXCount = x+1; | |
98 |
|
97 | |||
99 | domain.setRange(minX,maxX,minY,maxY,tickXCount,tickYCount); |
|
98 | domain.setRange(minX,maxX,minY,maxY,tickXCount,tickYCount); | |
100 | } |
|
99 | } | |
101 |
|
100 | |||
102 |
|
101 | |||
103 | Chart* QBarSeriesPrivate::createGraphics(ChartPresenter* presenter) |
|
102 | Chart* QBarSeriesPrivate::createGraphics(ChartPresenter* presenter) | |
104 | { |
|
103 | { | |
105 | Q_Q(QBarSeries); |
|
104 | Q_Q(QBarSeries); | |
106 |
|
105 | |||
107 | GroupedBarChartItem* bar = new GroupedBarChartItem(q,presenter); |
|
106 | GroupedBarChartItem* bar = new GroupedBarChartItem(q,presenter); | |
108 | if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) { |
|
107 | if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) { | |
109 | presenter->animator()->addAnimation(bar); |
|
108 | presenter->animator()->addAnimation(bar); | |
110 | } |
|
109 | } | |
111 | presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q)); |
|
110 | presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q)); | |
112 | return bar; |
|
111 | return bar; | |
113 | } |
|
112 | } | |
114 |
|
113 | |||
115 |
|
114 | |||
116 | #include "moc_qbarseries.cpp" |
|
115 | #include "moc_qbarseries.cpp" | |
117 |
|
116 | |||
118 | QTCOMMERCIALCHART_END_NAMESPACE |
|
117 | QTCOMMERCIALCHART_END_NAMESPACE | |
119 |
|
118 |
@@ -1,117 +1,116 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include "qpercentbarseries.h" |
|
21 | #include "qpercentbarseries.h" | |
22 | #include "qpercentbarseries_p.h" |
|
22 | #include "qpercentbarseries_p.h" | |
23 | #include "percentbarchartitem_p.h" |
|
23 | #include "percentbarchartitem_p.h" | |
24 | #include "chartdataset_p.h" |
|
24 | #include "chartdataset_p.h" | |
25 | #include "charttheme_p.h" |
|
25 | #include "charttheme_p.h" | |
26 | #include "chartanimator_p.h" |
|
26 | #include "chartanimator_p.h" | |
27 | #include "qcategoriesaxis.h" |
|
|||
28 | #include "qvaluesaxis.h" |
|
27 | #include "qvaluesaxis.h" | |
29 |
|
28 | |||
30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
31 |
|
30 | |||
32 | /*! |
|
31 | /*! | |
33 | \class QPercentBarSeries |
|
32 | \class QPercentBarSeries | |
34 | \brief Series for creating percent bar chart |
|
33 | \brief Series for creating percent bar chart | |
35 | \mainclass |
|
34 | \mainclass | |
36 |
|
35 | |||
37 | QPercentBarSeries represents a series of data shown as bars. The purpose of this class is to draw bars |
|
36 | QPercentBarSeries represents a series of data shown as bars. The purpose of this class is to draw bars | |
38 | as stacks, where each bar is shown as percentage of all bars in that category. |
|
37 | as stacks, where each bar is shown as percentage of all bars in that category. | |
39 | QPercentBarSeries groups the data from sets to categories, which are defined by a QStringList. |
|
38 | QPercentBarSeries groups the data from sets to categories, which are defined by a QStringList. | |
40 |
|
39 | |||
41 | See the \l {PercentbarChart Example} {percent bar chart example} to learn how to create a percent bar chart. |
|
40 | See the \l {PercentbarChart Example} {percent bar chart example} to learn how to create a percent bar chart. | |
42 | \image examples_percentbarchart.png |
|
41 | \image examples_percentbarchart.png | |
43 |
|
42 | |||
44 | \sa QBarSet, QStackedBarSeries, QAbstractBarSeries |
|
43 | \sa QBarSet, QStackedBarSeries, QAbstractBarSeries | |
45 | */ |
|
44 | */ | |
46 | /*! |
|
45 | /*! | |
47 | \qmlclass PercentBarSeries QPercentBarSeries |
|
46 | \qmlclass PercentBarSeries QPercentBarSeries | |
48 | \inherits QAbstractBarSeries |
|
47 | \inherits QAbstractBarSeries | |
49 |
|
48 | |||
50 | The following QML shows how to create a simple percent bar chart: |
|
49 | The following QML shows how to create a simple percent bar chart: | |
51 | \snippet ../demos/qmlchart/qml/qmlchart/View9.qml 1 |
|
50 | \snippet ../demos/qmlchart/qml/qmlchart/View9.qml 1 | |
52 | \beginfloatleft |
|
51 | \beginfloatleft | |
53 | \image demos_qmlchart9.png |
|
52 | \image demos_qmlchart9.png | |
54 | \endfloat |
|
53 | \endfloat | |
55 | \clearfloat |
|
54 | \clearfloat | |
56 | */ |
|
55 | */ | |
57 |
|
56 | |||
58 | /*! |
|
57 | /*! | |
59 | Constructs empty QPercentBarSeries. |
|
58 | Constructs empty QPercentBarSeries. | |
60 | QPercentBarSeries is QObject which is a child of a \a parent. |
|
59 | QPercentBarSeries is QObject which is a child of a \a parent. | |
61 | */ |
|
60 | */ | |
62 | QPercentBarSeries::QPercentBarSeries(QObject *parent) |
|
61 | QPercentBarSeries::QPercentBarSeries(QObject *parent) | |
63 | : QAbstractBarSeries(*new QPercentBarSeriesPrivate(this), parent) |
|
62 | : QAbstractBarSeries(*new QPercentBarSeriesPrivate(this), parent) | |
64 | { |
|
63 | { | |
65 | } |
|
64 | } | |
66 |
|
65 | |||
67 | /*! |
|
66 | /*! | |
68 | Returns QChartSeries::SeriesTypePercentBar. |
|
67 | Returns QChartSeries::SeriesTypePercentBar. | |
69 | */ |
|
68 | */ | |
70 | QAbstractSeries::SeriesType QPercentBarSeries::type() const |
|
69 | QAbstractSeries::SeriesType QPercentBarSeries::type() const | |
71 | { |
|
70 | { | |
72 | return QAbstractSeries::SeriesTypePercentBar; |
|
71 | return QAbstractSeries::SeriesTypePercentBar; | |
73 | } |
|
72 | } | |
74 |
|
73 | |||
75 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
74 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
76 |
|
75 | |||
77 | QPercentBarSeriesPrivate::QPercentBarSeriesPrivate(QPercentBarSeries *q) : QAbstractBarSeriesPrivate(q) |
|
76 | QPercentBarSeriesPrivate::QPercentBarSeriesPrivate(QPercentBarSeries *q) : QAbstractBarSeriesPrivate(q) | |
78 | { |
|
77 | { | |
79 |
|
78 | |||
80 | } |
|
79 | } | |
81 |
|
80 | |||
82 | void QPercentBarSeriesPrivate::scaleDomain(Domain& domain) |
|
81 | void QPercentBarSeriesPrivate::scaleDomain(Domain& domain) | |
83 | { |
|
82 | { | |
84 | qreal minX(domain.minX()); |
|
83 | qreal minX(domain.minX()); | |
85 | qreal minY(domain.minY()); |
|
84 | qreal minY(domain.minY()); | |
86 | qreal maxX(domain.maxX()); |
|
85 | qreal maxX(domain.maxX()); | |
87 | qreal maxY(domain.maxY()); |
|
86 | qreal maxY(domain.maxY()); | |
88 | int tickXCount(domain.tickXCount()); |
|
87 | int tickXCount(domain.tickXCount()); | |
89 | int tickYCount(domain.tickYCount()); |
|
88 | int tickYCount(domain.tickYCount()); | |
90 |
|
89 | |||
91 | qreal x = categoryCount(); |
|
90 | qreal x = categoryCount(); | |
92 | minX = qMin(minX, -0.5); |
|
91 | minX = qMin(minX, -0.5); | |
93 | maxX = qMax(maxX, x - 0.5); |
|
92 | maxX = qMax(maxX, x - 0.5); | |
94 | minY = 0; |
|
93 | minY = 0; | |
95 | maxY = 100; |
|
94 | maxY = 100; | |
96 | tickXCount = x+1; |
|
95 | tickXCount = x+1; | |
97 |
|
96 | |||
98 | domain.setRange(minX,maxX,minY,maxY,tickXCount,tickYCount); |
|
97 | domain.setRange(minX,maxX,minY,maxY,tickXCount,tickYCount); | |
99 | } |
|
98 | } | |
100 |
|
99 | |||
101 |
|
100 | |||
102 | Chart* QPercentBarSeriesPrivate::createGraphics(ChartPresenter* presenter) |
|
101 | Chart* QPercentBarSeriesPrivate::createGraphics(ChartPresenter* presenter) | |
103 | { |
|
102 | { | |
104 | Q_Q(QPercentBarSeries); |
|
103 | Q_Q(QPercentBarSeries); | |
105 |
|
104 | |||
106 | PercentBarChartItem* bar = new PercentBarChartItem(q,presenter); |
|
105 | PercentBarChartItem* bar = new PercentBarChartItem(q,presenter); | |
107 | if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) { |
|
106 | if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) { | |
108 | presenter->animator()->addAnimation(bar); |
|
107 | presenter->animator()->addAnimation(bar); | |
109 | } |
|
108 | } | |
110 | presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q)); |
|
109 | presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q)); | |
111 | return bar; |
|
110 | return bar; | |
112 | } |
|
111 | } | |
113 |
|
112 | |||
114 | #include "moc_qpercentbarseries.cpp" |
|
113 | #include "moc_qpercentbarseries.cpp" | |
115 |
|
114 | |||
116 | QTCOMMERCIALCHART_END_NAMESPACE |
|
115 | QTCOMMERCIALCHART_END_NAMESPACE | |
117 |
|
116 |
@@ -1,120 +1,119 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include "qstackedbarseries.h" |
|
21 | #include "qstackedbarseries.h" | |
22 | #include "qstackedbarseries_p.h" |
|
22 | #include "qstackedbarseries_p.h" | |
23 | #include "stackedbarchartitem_p.h" |
|
23 | #include "stackedbarchartitem_p.h" | |
24 | #include "chartdataset_p.h" |
|
24 | #include "chartdataset_p.h" | |
25 | #include "charttheme_p.h" |
|
25 | #include "charttheme_p.h" | |
26 | #include "chartanimator_p.h" |
|
26 | #include "chartanimator_p.h" | |
27 | #include "qcategoriesaxis.h" |
|
|||
28 | #include "qvaluesaxis.h" |
|
27 | #include "qvaluesaxis.h" | |
29 |
|
28 | |||
30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
31 |
|
30 | |||
32 | /*! |
|
31 | /*! | |
33 | \class QStackedBarSeries |
|
32 | \class QStackedBarSeries | |
34 | \brief Series for creating stacked bar chart |
|
33 | \brief Series for creating stacked bar chart | |
35 | \mainclass |
|
34 | \mainclass | |
36 |
|
35 | |||
37 | QStackedBarSeries represents a series of data shown as bars. The purpose of this class is to draw bars |
|
36 | QStackedBarSeries represents a series of data shown as bars. The purpose of this class is to draw bars | |
38 | as stacks, where bars in same category are stacked on top of each other. |
|
37 | as stacks, where bars in same category are stacked on top of each other. | |
39 | QStackedBarSeries groups the data from sets to categories, which are defined by QStringList. |
|
38 | QStackedBarSeries groups the data from sets to categories, which are defined by QStringList. | |
40 |
|
39 | |||
41 | See the \l {StackedbarChart Example} {stacked bar chart example} to learn how to create a stacked bar chart. |
|
40 | See the \l {StackedbarChart Example} {stacked bar chart example} to learn how to create a stacked bar chart. | |
42 | \image examples_stackedbarchart.png |
|
41 | \image examples_stackedbarchart.png | |
43 |
|
42 | |||
44 | \sa QBarSet, QPercentBarSeries, QAbstractBarSeries |
|
43 | \sa QBarSet, QPercentBarSeries, QAbstractBarSeries | |
45 | */ |
|
44 | */ | |
46 |
|
45 | |||
47 | /*! |
|
46 | /*! | |
48 | \qmlclass StackedBarSeries QStackedBarSeries |
|
47 | \qmlclass StackedBarSeries QStackedBarSeries | |
49 | \inherits AbstractBarSeries |
|
48 | \inherits AbstractBarSeries | |
50 |
|
49 | |||
51 | The following QML shows how to create a simple stacked bar chart: |
|
50 | The following QML shows how to create a simple stacked bar chart: | |
52 | \snippet ../demos/qmlchart/qml/qmlchart/View8.qml 1 |
|
51 | \snippet ../demos/qmlchart/qml/qmlchart/View8.qml 1 | |
53 | \beginfloatleft |
|
52 | \beginfloatleft | |
54 | \image demos_qmlchart8.png |
|
53 | \image demos_qmlchart8.png | |
55 | \endfloat |
|
54 | \endfloat | |
56 | \clearfloat |
|
55 | \clearfloat | |
57 | */ |
|
56 | */ | |
58 |
|
57 | |||
59 | /*! |
|
58 | /*! | |
60 | Constructs empty QStackedBarSeries. |
|
59 | Constructs empty QStackedBarSeries. | |
61 | QStackedBarSeries is QObject which is a child of a \a parent. |
|
60 | QStackedBarSeries is QObject which is a child of a \a parent. | |
62 | */ |
|
61 | */ | |
63 | QStackedBarSeries::QStackedBarSeries(QObject *parent) |
|
62 | QStackedBarSeries::QStackedBarSeries(QObject *parent) | |
64 | : QAbstractBarSeries(*new QStackedBarSeriesPrivate(this), parent) |
|
63 | : QAbstractBarSeries(*new QStackedBarSeriesPrivate(this), parent) | |
65 | { |
|
64 | { | |
66 | } |
|
65 | } | |
67 |
|
66 | |||
68 | /*! |
|
67 | /*! | |
69 | Returns QChartSeries::SeriesTypeStackedBar. |
|
68 | Returns QChartSeries::SeriesTypeStackedBar. | |
70 | */ |
|
69 | */ | |
71 | QAbstractSeries::SeriesType QStackedBarSeries::type() const |
|
70 | QAbstractSeries::SeriesType QStackedBarSeries::type() const | |
72 | { |
|
71 | { | |
73 | return QAbstractSeries::SeriesTypeStackedBar; |
|
72 | return QAbstractSeries::SeriesTypeStackedBar; | |
74 | } |
|
73 | } | |
75 |
|
74 | |||
76 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
75 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
77 |
|
76 | |||
78 | QStackedBarSeriesPrivate::QStackedBarSeriesPrivate(QStackedBarSeries *q) : QAbstractBarSeriesPrivate(q) |
|
77 | QStackedBarSeriesPrivate::QStackedBarSeriesPrivate(QStackedBarSeries *q) : QAbstractBarSeriesPrivate(q) | |
79 | { |
|
78 | { | |
80 |
|
79 | |||
81 | } |
|
80 | } | |
82 |
|
81 | |||
83 | void QStackedBarSeriesPrivate::scaleDomain(Domain& domain) |
|
82 | void QStackedBarSeriesPrivate::scaleDomain(Domain& domain) | |
84 | { |
|
83 | { | |
85 | qreal minX(domain.minX()); |
|
84 | qreal minX(domain.minX()); | |
86 | qreal minY(domain.minY()); |
|
85 | qreal minY(domain.minY()); | |
87 | qreal maxX(domain.maxX()); |
|
86 | qreal maxX(domain.maxX()); | |
88 | qreal maxY(domain.maxY()); |
|
87 | qreal maxY(domain.maxY()); | |
89 | int tickXCount(domain.tickXCount()); |
|
88 | int tickXCount(domain.tickXCount()); | |
90 | int tickYCount(domain.tickYCount()); |
|
89 | int tickYCount(domain.tickYCount()); | |
91 |
|
90 | |||
92 | qreal x = categoryCount(); |
|
91 | qreal x = categoryCount(); | |
93 | qreal y = maxCategorySum(); |
|
92 | qreal y = maxCategorySum(); | |
94 | minX = qMin(minX, -0.5); |
|
93 | minX = qMin(minX, -0.5); | |
95 | minY = qMin(minY, y); |
|
94 | minY = qMin(minY, y); | |
96 | maxX = qMax(maxX, x - 0.5); |
|
95 | maxX = qMax(maxX, x - 0.5); | |
97 | maxY = qMax(maxY, y); |
|
96 | maxY = qMax(maxY, y); | |
98 | tickXCount = x+1; |
|
97 | tickXCount = x+1; | |
99 |
|
98 | |||
100 | domain.setRange(minX,maxX,minY,maxY,tickXCount,tickYCount); |
|
99 | domain.setRange(minX,maxX,minY,maxY,tickXCount,tickYCount); | |
101 | } |
|
100 | } | |
102 |
|
101 | |||
103 |
|
102 | |||
104 | Chart* QStackedBarSeriesPrivate::createGraphics(ChartPresenter* presenter) |
|
103 | Chart* QStackedBarSeriesPrivate::createGraphics(ChartPresenter* presenter) | |
105 | { |
|
104 | { | |
106 | Q_Q(QStackedBarSeries); |
|
105 | Q_Q(QStackedBarSeries); | |
107 |
|
106 | |||
108 | StackedBarChartItem* bar = new StackedBarChartItem(q,presenter); |
|
107 | StackedBarChartItem* bar = new StackedBarChartItem(q,presenter); | |
109 | if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) { |
|
108 | if(presenter->animationOptions().testFlag(QChart::SeriesAnimations)) { | |
110 | presenter->animator()->addAnimation(bar); |
|
109 | presenter->animator()->addAnimation(bar); | |
111 | } |
|
110 | } | |
112 | presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q)); |
|
111 | presenter->chartTheme()->decorate(q, presenter->dataSet()->seriesIndex(q)); | |
113 | return bar; |
|
112 | return bar; | |
114 | } |
|
113 | } | |
115 |
|
114 | |||
116 |
|
115 | |||
117 | #include "moc_qstackedbarseries.cpp" |
|
116 | #include "moc_qstackedbarseries.cpp" | |
118 |
|
117 | |||
119 | QTCOMMERCIALCHART_END_NAMESPACE |
|
118 | QTCOMMERCIALCHART_END_NAMESPACE | |
120 |
|
119 |
General Comments 0
You need to be logged in to leave comments.
Login now