1 | NO CONTENT: modified file |
|
NO CONTENT: modified file |
@@ -89,12 +89,12 int main(int argc, char *argv[]) | |||||
89 | //![3] |
|
89 | //![3] | |
90 |
|
90 | |||
91 | //![4] |
|
91 | //![4] | |
92 |
Q |
|
92 | QAxisCategories* categoriesX = chart->axisX()->categories(); | |
93 | categoriesX->insert(1,"low"); |
|
93 | categoriesX->insert(1,"low"); | |
94 | categoriesX->insert(5,"optimal"); |
|
94 | categoriesX->insert(5,"optimal"); | |
95 | categoriesX->insert(10,"high"); |
|
95 | categoriesX->insert(10,"high"); | |
96 |
|
96 | |||
97 |
Q |
|
97 | QAxisCategories* categoriesY = chart->axisY()->categories(); | |
98 | categoriesY->insert(1,"slow"); |
|
98 | categoriesY->insert(1,"slow"); | |
99 | categoriesY->insert(5,"med"); |
|
99 | categoriesY->insert(5,"med"); | |
100 | categoriesY->insert(10,"fast"); |
|
100 | categoriesY->insert(10,"fast"); |
@@ -4,13 +4,13 DEPENDPATH += $$PWD | |||||
4 | SOURCES += \ |
|
4 | SOURCES += \ | |
5 | $$PWD/chartaxis.cpp \ |
|
5 | $$PWD/chartaxis.cpp \ | |
6 | $$PWD/qaxis.cpp \ |
|
6 | $$PWD/qaxis.cpp \ | |
7 |
$$PWD/q |
|
7 | $$PWD/qaxiscategories.cpp | |
8 |
|
8 | |||
9 | PRIVATE_HEADERS += \ |
|
9 | PRIVATE_HEADERS += \ | |
10 | $$PWD/chartaxis_p.h \ |
|
10 | $$PWD/chartaxis_p.h \ | |
11 | $$PWD/qaxis_p.h \ |
|
11 | $$PWD/qaxis_p.h \ | |
12 |
$$PWD/q |
|
12 | $$PWD/qaxiscategories_p.h | |
13 |
|
13 | |||
14 | PUBLIC_HEADERS += \ |
|
14 | PUBLIC_HEADERS += \ | |
15 | $$PWD/qaxis.h \ |
|
15 | $$PWD/qaxis.h \ | |
16 |
$$PWD/q |
|
16 | $$PWD/qaxiscategories.h No newline at end of file |
@@ -21,7 +21,7 | |||||
21 | #include "chartaxis_p.h" |
|
21 | #include "chartaxis_p.h" | |
22 | #include "qaxis.h" |
|
22 | #include "qaxis.h" | |
23 | #include "qaxis_p.h" |
|
23 | #include "qaxis_p.h" | |
24 |
#include "q |
|
24 | #include "qaxiscategories_p.h" | |
25 | #include "chartpresenter_p.h" |
|
25 | #include "chartpresenter_p.h" | |
26 | #include "chartanimator_p.h" |
|
26 | #include "chartanimator_p.h" | |
27 | #include <QPainter> |
|
27 | #include <QPainter> | |
@@ -103,7 +103,7 bool ChartAxis::createLabels(QStringList &labels,qreal min, qreal max,int ticks) | |||||
103 | Q_ASSERT(max>=min); |
|
103 | Q_ASSERT(max>=min); | |
104 | Q_ASSERT(ticks>1); |
|
104 | Q_ASSERT(ticks>1); | |
105 |
|
105 | |||
106 |
Q |
|
106 | QAxisCategories* categories = m_chartAxis->categories(); | |
107 |
|
107 | |||
108 | bool category = categories->count()>0; |
|
108 | bool category = categories->count()>0; | |
109 |
|
109 |
@@ -493,7 +493,7 bool QAxis::niceNumbersEnabled() const | |||||
493 | return d_ptr->m_niceNumbers; |
|
493 | return d_ptr->m_niceNumbers; | |
494 | } |
|
494 | } | |
495 |
|
495 | |||
496 |
Q |
|
496 | QAxisCategories* QAxis::categories() | |
497 | { |
|
497 | { | |
498 | return &d_ptr->m_category; |
|
498 | return &d_ptr->m_category; | |
499 | } |
|
499 | } |
@@ -22,7 +22,7 | |||||
22 | #define QAXIS_H |
|
22 | #define QAXIS_H | |
23 |
|
23 | |||
24 | #include <qchartglobal.h> |
|
24 | #include <qchartglobal.h> | |
25 |
#include <q |
|
25 | #include <qaxiscategories.h> | |
26 | #include <QPen> |
|
26 | #include <QPen> | |
27 | #include <QFont> |
|
27 | #include <QFont> | |
28 |
|
28 | |||
@@ -86,7 +86,7 public: | |||||
86 | void setNiceNumbersEnabled(bool enable = true); |
|
86 | void setNiceNumbersEnabled(bool enable = true); | |
87 | bool niceNumbersEnabled() const; |
|
87 | bool niceNumbersEnabled() const; | |
88 |
|
88 | |||
89 |
Q |
|
89 | QAxisCategories* categories(); | |
90 |
|
90 | |||
91 | void show(); |
|
91 | void show(); | |
92 | void hide(); |
|
92 | void hide(); |
@@ -73,7 +73,7 private: | |||||
73 | qreal m_max; |
|
73 | qreal m_max; | |
74 |
|
74 | |||
75 | int m_ticksCount; |
|
75 | int m_ticksCount; | |
76 |
Q |
|
76 | QAxisCategories m_category; | |
77 |
|
77 | |||
78 | bool m_niceNumbers; |
|
78 | bool m_niceNumbers; | |
79 |
|
79 |
@@ -18,23 +18,23 | |||||
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 |
#include "q |
|
21 | #include "qaxiscategories.h" | |
22 |
#include "q |
|
22 | #include "qaxiscategories_p.h" | |
23 |
|
23 | |||
24 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
24 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
25 |
|
25 | |||
26 |
Q |
|
26 | QAxisCategories::QAxisCategories(): | |
27 |
d_ptr(new Q |
|
27 | d_ptr(new QAxisCategoriesPrivate(this)) | |
28 | { |
|
28 | { | |
29 |
|
29 | |||
30 | } |
|
30 | } | |
31 |
|
31 | |||
32 |
Q |
|
32 | QAxisCategories::~QAxisCategories() | |
33 | { |
|
33 | { | |
34 |
|
34 | |||
35 | } |
|
35 | } | |
36 |
|
36 | |||
37 |
void Q |
|
37 | void QAxisCategories::insert(const QBarCategories &categories) | |
38 | { |
|
38 | { | |
39 | int i=1; |
|
39 | int i=1; | |
40 | foreach (const QString& string , categories) { |
|
40 | foreach (const QString& string , categories) { | |
@@ -44,53 +44,53 void QChartAxisCategories::insert(const QBarCategories &categories) | |||||
44 | emit d_ptr->updated(); |
|
44 | emit d_ptr->updated(); | |
45 | } |
|
45 | } | |
46 |
|
46 | |||
47 |
void Q |
|
47 | void QAxisCategories::insert(qreal value,QString label) | |
48 | { |
|
48 | { | |
49 | d_ptr->m_map.insert(value,label); |
|
49 | d_ptr->m_map.insert(value,label); | |
50 | emit d_ptr->updated(); |
|
50 | emit d_ptr->updated(); | |
51 | } |
|
51 | } | |
52 |
|
52 | |||
53 |
void Q |
|
53 | void QAxisCategories::remove(qreal value) | |
54 | { |
|
54 | { | |
55 | d_ptr->m_map.remove(value); |
|
55 | d_ptr->m_map.remove(value); | |
56 | emit d_ptr->updated(); |
|
56 | emit d_ptr->updated(); | |
57 | } |
|
57 | } | |
58 |
|
58 | |||
59 |
void Q |
|
59 | void QAxisCategories::clear() | |
60 | { |
|
60 | { | |
61 | d_ptr->m_map.clear(); |
|
61 | d_ptr->m_map.clear(); | |
62 | emit d_ptr->updated(); |
|
62 | emit d_ptr->updated(); | |
63 | } |
|
63 | } | |
64 |
|
64 | |||
65 |
int Q |
|
65 | int QAxisCategories::count() | |
66 | { |
|
66 | { | |
67 | return d_ptr->m_map.count(); |
|
67 | return d_ptr->m_map.count(); | |
68 | } |
|
68 | } | |
69 |
|
69 | |||
70 |
QList<qreal> Q |
|
70 | QList<qreal> QAxisCategories::values() const | |
71 | { |
|
71 | { | |
72 | return d_ptr->m_map.keys(); |
|
72 | return d_ptr->m_map.keys(); | |
73 | } |
|
73 | } | |
74 |
|
74 | |||
75 |
QString Q |
|
75 | QString QAxisCategories::label(qreal value) const | |
76 | { |
|
76 | { | |
77 | return d_ptr->m_map.value(value); |
|
77 | return d_ptr->m_map.value(value); | |
78 | } |
|
78 | } | |
79 |
|
79 | |||
80 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
80 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
81 |
|
81 | |||
82 |
Q |
|
82 | QAxisCategoriesPrivate::QAxisCategoriesPrivate(QAxisCategories *q): | |
83 | q_ptr(q) |
|
83 | q_ptr(q) | |
84 | { |
|
84 | { | |
85 |
|
85 | |||
86 | } |
|
86 | } | |
87 |
|
87 | |||
88 |
Q |
|
88 | QAxisCategoriesPrivate::~QAxisCategoriesPrivate() | |
89 | { |
|
89 | { | |
90 |
|
90 | |||
91 | } |
|
91 | } | |
92 |
|
92 | |||
93 |
#include "moc_q |
|
93 | #include "moc_qaxiscategories.cpp" | |
94 |
#include "moc_q |
|
94 | #include "moc_qaxiscategories_p.cpp" | |
95 |
|
95 | |||
96 | QTCOMMERCIALCHART_END_NAMESPACE |
|
96 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -18,23 +18,23 | |||||
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 |
#ifndef Q |
|
21 | #ifndef QAXISCATEGORIES_H | |
22 |
#define Q |
|
22 | #define QAXISCATEGORIES_H | |
23 |
|
23 | |||
24 | #include <qchartglobal.h> |
|
24 | #include <qchartglobal.h> | |
25 | #include <qbarseries.h> |
|
25 | #include <qbarseries.h> | |
26 |
|
26 | |||
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
27 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
28 |
|
28 | |||
29 |
class Q |
|
29 | class QAxisCategoriesPrivate; | |
30 |
|
30 | |||
31 |
class QTCOMMERCIALCHART_EXPORT Q |
|
31 | class QTCOMMERCIALCHART_EXPORT QAxisCategories : public QObject | |
32 | { |
|
32 | { | |
33 | Q_OBJECT |
|
33 | Q_OBJECT | |
34 | private: |
|
34 | private: | |
35 |
Q |
|
35 | QAxisCategories(); | |
36 | public: |
|
36 | public: | |
37 |
~Q |
|
37 | ~QAxisCategories(); | |
38 |
|
38 | |||
39 | void insert(const QBarCategories &category); |
|
39 | void insert(const QBarCategories &category); | |
40 | void insert(qreal value,QString label); |
|
40 | void insert(qreal value,QString label); | |
@@ -45,7 +45,7 public: | |||||
45 | int count(); |
|
45 | int count(); | |
46 |
|
46 | |||
47 | private: |
|
47 | private: | |
48 |
QScopedPointer<Q |
|
48 | QScopedPointer<QAxisCategoriesPrivate> d_ptr; | |
49 | friend class QAxisPrivate; |
|
49 | friend class QAxisPrivate; | |
50 | friend class ChartAxis; |
|
50 | friend class ChartAxis; | |
51 | }; |
|
51 | }; |
@@ -27,28 +27,28 | |||||
27 | // |
|
27 | // | |
28 | // We mean it. |
|
28 | // We mean it. | |
29 |
|
29 | |||
30 |
#ifndef Q |
|
30 | #ifndef QAXISCATEGORIES_P_H | |
31 |
#define Q |
|
31 | #define QAXISCATEGORIES_P_H | |
32 |
|
32 | |||
33 |
#include "q |
|
33 | #include "qaxiscategories.h" | |
34 | #include <QMap> |
|
34 | #include <QMap> | |
35 |
|
35 | |||
36 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
36 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
37 |
|
37 | |||
38 |
class Q |
|
38 | class QAxisCategoriesPrivate : public QObject | |
39 | { |
|
39 | { | |
40 | Q_OBJECT |
|
40 | Q_OBJECT | |
41 | public: |
|
41 | public: | |
42 |
Q |
|
42 | QAxisCategoriesPrivate(QAxisCategories *q); | |
43 |
~Q |
|
43 | ~QAxisCategoriesPrivate(); | |
44 |
|
44 | |||
45 | Q_SIGNALS: |
|
45 | Q_SIGNALS: | |
46 | void updated(); |
|
46 | void updated(); | |
47 |
|
47 | |||
48 | private: |
|
48 | private: | |
49 |
Q |
|
49 | QAxisCategories *q_ptr; | |
50 | QMap<qreal,QString> m_map; |
|
50 | QMap<qreal,QString> m_map; | |
51 |
friend class Q |
|
51 | friend class QAxisCategories; | |
52 |
|
52 | |||
53 | }; |
|
53 | }; | |
54 |
|
54 |
@@ -26,8 +26,6 | |||||
26 | #include "qbarseries.h" |
|
26 | #include "qbarseries.h" | |
27 | #include "qbarseries_p.h" |
|
27 | #include "qbarseries_p.h" | |
28 | #include "qchart.h" |
|
28 | #include "qchart.h" | |
29 | //#include "qchartaxis.h" |
|
|||
30 | #include "qchartaxiscategories.h" |
|
|||
31 | #include "chartpresenter_p.h" |
|
29 | #include "chartpresenter_p.h" | |
32 | #include "chartanimator_p.h" |
|
30 | #include "chartanimator_p.h" | |
33 | #include "chartdataset_p.h" |
|
31 | #include "chartdataset_p.h" |
@@ -30,7 +30,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
30 |
|
30 | |||
31 | class Bar; |
|
31 | class Bar; | |
32 | class BarLabel; |
|
32 | class BarLabel; | |
33 |
class Q |
|
33 | class QAxisCategories; | |
34 | class QChart; |
|
34 | class QChart; | |
35 |
|
35 | |||
36 | //typedef QVector<QRectF> BarLayout; |
|
36 | //typedef QVector<QRectF> BarLayout; |
@@ -168,7 +168,7 void ChartDataSet::removeAllSeries() | |||||
168 |
|
168 | |||
169 | void ChartDataSet::setupCategories(QBarSeries* series) |
|
169 | void ChartDataSet::setupCategories(QBarSeries* series) | |
170 | { |
|
170 | { | |
171 |
Q |
|
171 | QAxisCategories* categories = axisX()->categories(); | |
172 | categories->clear(); |
|
172 | categories->clear(); | |
173 | categories->insert(series->categories()); |
|
173 | categories->insert(series->categories()); | |
174 | } |
|
174 | } |
General Comments 0
You need to be logged in to leave comments.
Login now