@@ -29,7 +29,7 | |||
|
29 | 29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
30 | 30 | |
|
31 | 31 | static const char *labelFormatMatchString = "%[\\-\\+#\\s\\d\\.lhjztL]*([dicuoxfegXFEG])"; |
|
32 | static const char *labelFormatMatchLocalizedString = "^([^%]*)%\\.?(\\d)*([defgEG])(.*)$"; | |
|
32 | static const char *labelFormatMatchLocalizedString = "^([^%]*)%\\.?(\\d)*([defgiEG])(.*)$"; | |
|
33 | 33 | static QRegExp *labelFormatMatcher = 0; |
|
34 | 34 | static QRegExp *labelFormatMatcherLocalized = 0; |
|
35 | 35 | class StaticLabelFormatMatcherDeleter |
@@ -295,12 +295,13 QStringList ChartAxisElement::createValueLabels(qreal min, qreal max, int ticks, | |||
|
295 | 295 | QString formatSpec; |
|
296 | 296 | QString preStr; |
|
297 | 297 | QString postStr; |
|
298 | int precision = 0; | |
|
298 | int precision = 6; // Six is the default precision in Qt API | |
|
299 | 299 | if (presenter()->localizeNumbers()) { |
|
300 | 300 | if (!labelFormatMatcherLocalized) |
|
301 | 301 | labelFormatMatcherLocalized = new QRegExp(labelFormatMatchLocalizedString); |
|
302 | 302 | if (labelFormatMatcherLocalized->indexIn(format, 0) != -1) { |
|
303 | 303 | preStr = labelFormatMatcherLocalized->cap(1); |
|
304 | if (!labelFormatMatcherLocalized->cap(2).isEmpty()) | |
|
304 | 305 | precision = labelFormatMatcherLocalized->cap(2).toInt(); |
|
305 | 306 | formatSpec = labelFormatMatcherLocalized->cap(3); |
|
306 | 307 | postStr = labelFormatMatcherLocalized->cap(4); |
@@ -348,12 +349,13 QStringList ChartAxisElement::createLogValueLabels(qreal min, qreal max, qreal b | |||
|
348 | 349 | QString formatSpec; |
|
349 | 350 | QString preStr; |
|
350 | 351 | QString postStr; |
|
351 | int precision = 0; | |
|
352 | int precision = 6; // Six is the default precision in Qt API | |
|
352 | 353 | if (presenter()->localizeNumbers()) { |
|
353 | 354 | if (!labelFormatMatcherLocalized) |
|
354 | 355 | labelFormatMatcherLocalized = new QRegExp(labelFormatMatchLocalizedString); |
|
355 | 356 | if (labelFormatMatcherLocalized->indexIn(format, 0) != -1) { |
|
356 | 357 | preStr = labelFormatMatcherLocalized->cap(1); |
|
358 | if (!labelFormatMatcherLocalized->cap(2).isEmpty()) | |
|
357 | 359 | precision = labelFormatMatcherLocalized->cap(2).toInt(); |
|
358 | 360 | formatSpec = labelFormatMatcherLocalized->cap(3); |
|
359 | 361 | postStr = labelFormatMatcherLocalized->cap(4); |
@@ -110,7 +110,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
110 | 110 | See QString::sprintf() for additional details. |
|
111 | 111 | |
|
112 | 112 | If the QChart::localizeNumbers is \c{true}, the supported specifiers are limited to: d, e, E, f, |
|
113 |
g, |
|
|
113 | g, G, and i. Also, only the precision modifier is supported. The rest of the formatting comes from | |
|
114 | 114 | the default QLocale of the application. |
|
115 | 115 | */ |
|
116 | 116 | /*! |
@@ -120,7 +120,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
120 | 120 | See QString::sprintf() for additional details. |
|
121 | 121 | |
|
122 | 122 | If the ChartView::localizeNumbers is \c{true}, the supported specifiers are limited to: d, e, E, f, |
|
123 |
g, |
|
|
123 | g, G, and i. Also, only the precision modifier is supported. The rest of the formatting comes from | |
|
124 | 124 | the default QLocale of the application. |
|
125 | 125 | */ |
|
126 | 126 |
@@ -950,7 +950,7 void QAbstractBarSeriesPrivate::populateCategories(QBarCategoryAxis *axis) | |||
|
950 | 950 | QStringList categories; |
|
951 | 951 | if (axis->categories().isEmpty()) { |
|
952 | 952 | for (int i(1); i < categoryCount() + 1; i++) |
|
953 |
categories << |
|
|
953 | categories << presenter()->numberToString(i); | |
|
954 | 954 | axis->append(categories); |
|
955 | 955 | } |
|
956 | 956 | } |
@@ -418,7 +418,7 void QBoxPlotSeriesPrivate::populateCategories(QBarCategoryAxis *axis) | |||
|
418 | 418 | for (int i(1); i < m_boxSets.count() + 1; i++) { |
|
419 | 419 | QBoxSet *set = m_boxSets.at(i - 1); |
|
420 | 420 | if (set->label().isEmpty()) |
|
421 |
categories << |
|
|
421 | categories << presenter()->numberToString(i); | |
|
422 | 422 | else |
|
423 | 423 | categories << set->label(); |
|
424 | 424 | } |
@@ -496,6 +496,14 QString ChartPresenter::numberToString(double value, char f, int prec) | |||
|
496 | 496 | return QString::number(value, f, prec); |
|
497 | 497 | } |
|
498 | 498 | |
|
499 | QString ChartPresenter::numberToString(int value) | |
|
500 | { | |
|
501 | if (m_localizeNumbers) | |
|
502 | return m_locale.toString(value); | |
|
503 | else | |
|
504 | return QString::number(value); | |
|
505 | } | |
|
506 | ||
|
499 | 507 | #include "moc_chartpresenter_p.cpp" |
|
500 | 508 | |
|
501 | 509 | QTCOMMERCIALCHART_END_NAMESPACE |
General Comments 0
You need to be logged in to leave comments.
Login now