@@ -22,7 +22,7 | |||||
22 | #include <QtDeclarative/qdeclarative.h> |
|
22 | #include <QtDeclarative/qdeclarative.h> | |
23 | #include "qchart.h" |
|
23 | #include "qchart.h" | |
24 | #include "qabstractaxis.h" |
|
24 | #include "qabstractaxis.h" | |
25 | #include "qaxiscategories.h" |
|
25 | //#include "qaxiscategories.h" | |
26 | #include "declarativechart.h" |
|
26 | #include "declarativechart.h" | |
27 | #include "declarativexypoint.h" |
|
27 | #include "declarativexypoint.h" | |
28 | #include "declarativelineseries.h" |
|
28 | #include "declarativelineseries.h" |
@@ -5,7 +5,7 SOURCES += \ | |||||
5 | $$PWD/chartaxis.cpp \ |
|
5 | $$PWD/chartaxis.cpp \ | |
6 | $$PWD/chartaxisx.cpp \ |
|
6 | $$PWD/chartaxisx.cpp \ | |
7 | $$PWD/chartaxisy.cpp \ |
|
7 | $$PWD/chartaxisy.cpp \ | |
8 | $$PWD/qaxiscategories.cpp \ |
|
8 | # $$PWD/qaxiscategories.cpp \ | |
9 | $$PWD/qcategoriesaxis.cpp \ |
|
9 | $$PWD/qcategoriesaxis.cpp \ | |
10 | $$PWD/qvaluesaxis.cpp \ |
|
10 | $$PWD/qvaluesaxis.cpp \ | |
11 | $$PWD/qabstractaxis.cpp |
|
11 | $$PWD/qabstractaxis.cpp | |
@@ -14,13 +14,13 PRIVATE_HEADERS += \ | |||||
14 | $$PWD/chartaxis_p.h \ |
|
14 | $$PWD/chartaxis_p.h \ | |
15 | $$PWD/chartaxisx_p.h \ |
|
15 | $$PWD/chartaxisx_p.h \ | |
16 | $$PWD/chartaxisy_p.h \ |
|
16 | $$PWD/chartaxisy_p.h \ | |
17 | $$PWD/qaxiscategories_p.h \ |
|
17 | # $$PWD/qaxiscategories_p.h \ | |
18 | $$PWD/qcategoriesaxis_p.h \ |
|
18 | $$PWD/qcategoriesaxis_p.h \ | |
19 | $$PWD/qvaluesaxis_p.h \ |
|
19 | $$PWD/qvaluesaxis_p.h \ | |
20 | $$PWD/qabstractaxis_p.h |
|
20 | $$PWD/qabstractaxis_p.h | |
21 |
|
21 | |||
22 | PUBLIC_HEADERS += \ |
|
22 | PUBLIC_HEADERS += \ | |
23 | $$PWD/qaxiscategories.h \ |
|
23 | # $$PWD/qaxiscategories.h \ | |
24 | $$PWD/qcategoriesaxis.h \ |
|
24 | $$PWD/qcategoriesaxis.h \ | |
25 | $$PWD/qvaluesaxis.h \ |
|
25 | $$PWD/qvaluesaxis.h \ | |
26 | $$PWD/qabstractaxis.h No newline at end of file |
|
26 | $$PWD/qabstractaxis.h |
@@ -150,11 +150,11 bool ChartAxis::createLabels(QStringList &labels,qreal min, qreal max,int ticks) | |||||
150 | Q_ASSERT(ticks>1); |
|
150 | Q_ASSERT(ticks>1); | |
151 |
|
151 | |||
152 | //TODO:: QAxisCategories* categories = m_chartAxis->categories(); |
|
152 | //TODO:: QAxisCategories* categories = m_chartAxis->categories(); | |
153 | QAxisCategories* categories = new QAxisCategories(); |
|
153 | // QAxisCategories* categories = new QAxisCategories(); | |
154 |
|
154 | |||
155 | bool category = categories->count()>0; |
|
155 | // bool category = categories->count()>0; | |
156 |
|
156 | |||
157 | if (!category) { |
|
157 | // if (!category) { | |
158 | int n = qMax(int(-floor(log10((max-min)/(ticks-1)))),0); |
|
158 | int n = qMax(int(-floor(log10((max-min)/(ticks-1)))),0); | |
159 | n++; |
|
159 | n++; | |
160 | for (int i=0; i< ticks; i++) { |
|
160 | for (int i=0; i< ticks; i++) { | |
@@ -162,22 +162,23 bool ChartAxis::createLabels(QStringList &labels,qreal min, qreal max,int ticks) | |||||
162 | Q_UNUSED(value); |
|
162 | Q_UNUSED(value); | |
163 | labels << QString::number(value,'f',n); |
|
163 | labels << QString::number(value,'f',n); | |
164 | } |
|
164 | } | |
165 | } else { |
|
165 | // } else { | |
166 | QList<qreal> values = categories->values(); |
|
166 | // QList<qreal> values = categories->values(); | |
167 | for (int i=0; i< ticks; i++) { |
|
167 | // for (int i=0; i< ticks; i++) { | |
168 | qreal value = (min + (i * (max - min)/ (ticks-1))); |
|
168 | // qreal value = (min + (i * (max - min)/ (ticks-1))); | |
169 | int j=0; |
|
169 | // int j=0; | |
170 | for (; j<values.count(); j++) { |
|
170 | // for (; j<values.count(); j++) { | |
171 | if (values.at(j) > value) break; |
|
171 | // if (values.at(j) > value) break; | |
172 | } |
|
172 | // } | |
173 | if (j!=0) value=values.at(j-1); |
|
173 | // if (j!=0) value=values.at(j-1); | |
174 |
|
174 | |||
175 | QString label = categories->label(value); |
|
175 | // QString label = categories->label(value); | |
176 | labels << label; |
|
176 | // labels << label; | |
177 | } |
|
177 | // } | |
178 | } |
|
178 | // } | |
179 |
|
179 | |||
180 | return category; |
|
180 | // return category; | |
|
181 | return true; | |||
181 | } |
|
182 | } | |
182 |
|
183 | |||
183 | void ChartAxis::setAxisOpacity(qreal opacity) |
|
184 | void ChartAxis::setAxisOpacity(qreal opacity) | |
@@ -204,6 +205,7 void ChartAxis::setLabelsOpacity(qreal opacity) | |||||
204 | { |
|
205 | { | |
205 | m_labels->setOpacity(opacity); |
|
206 | m_labels->setOpacity(opacity); | |
206 | } |
|
207 | } | |
|
208 | #include "qaxiscategories.h" | |||
207 |
|
209 | |||
208 | qreal ChartAxis::labelsOpacity() const |
|
210 | qreal ChartAxis::labelsOpacity() const | |
209 | { |
|
211 | { |
@@ -55,6 +55,20 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
55 | */ |
|
55 | */ | |
56 |
|
56 | |||
57 | /*! |
|
57 | /*! | |
|
58 | \enum QAbstractAxis::AxisType | |||
|
59 | ||||
|
60 | The type of the series object. | |||
|
61 | ||||
|
62 | \value AxisTypeValues | |||
|
63 | \value AxisTypeCategories | |||
|
64 | */ | |||
|
65 | ||||
|
66 | /*! | |||
|
67 | \property QAbstractAxis::type | |||
|
68 | The type of the axis. | |||
|
69 | */ | |||
|
70 | ||||
|
71 | /*! | |||
58 | \property QAbstractAxis::labelsVisible |
|
72 | \property QAbstractAxis::labelsVisible | |
59 | Defines if axis labels are visible. |
|
73 | Defines if axis labels are visible. | |
60 | */ |
|
74 | */ |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now