@@ -80,23 +80,23 QCategoryAxis::QCategoryAxis(QCategoryAxisPrivate &d,QObject *parent):QValueAxis | |||||
80 | /*! |
|
80 | /*! | |
81 | Appends new category to the axis with an \a categoryLabel. |
|
81 | Appends new category to the axis with an \a categoryLabel. | |
82 | Category label has to be unique. |
|
82 | Category label has to be unique. | |
83 |
Parameter \a category |
|
83 | Parameter \a categoryEndValue specifies the high end limit of the category. | |
84 | It has to be greater than the high end limit of the previous category. |
|
84 | It has to be greater than the high end limit of the previous category. | |
85 | Otherwise the method returns without adding a new category. |
|
85 | Otherwise the method returns without adding a new category. | |
86 | */ |
|
86 | */ | |
87 |
void QCategoryAxis::append(const QString& categoryLabel, qreal category |
|
87 | void QCategoryAxis::append(const QString& categoryLabel, qreal categoryEndValue) | |
88 | { |
|
88 | { | |
89 | Q_D(QCategoryAxis); |
|
89 | Q_D(QCategoryAxis); | |
90 |
|
90 | |||
91 | if (!d->m_categories.contains(categoryLabel)) |
|
91 | if (!d->m_categories.contains(categoryLabel)) | |
92 | { |
|
92 | { | |
93 | if(d->m_categories.isEmpty()){ |
|
93 | if(d->m_categories.isEmpty()){ | |
94 |
Range range(d->m_categoryMinimum, category |
|
94 | Range range(d->m_categoryMinimum, categoryEndValue); | |
95 | d->m_categoriesMap.insert(categoryLabel, range); |
|
95 | d->m_categoriesMap.insert(categoryLabel, range); | |
96 | d->m_categories.append(categoryLabel); |
|
96 | d->m_categories.append(categoryLabel); | |
97 |
}else if (category |
|
97 | }else if (categoryEndValue > endValue(d->m_categories.last())){ | |
98 | Range previousRange = d->m_categoriesMap.value(d->m_categories.last()); |
|
98 | Range previousRange = d->m_categoriesMap.value(d->m_categories.last()); | |
99 |
d->m_categoriesMap.insert(categoryLabel, Range(previousRange.second, category |
|
99 | d->m_categoriesMap.insert(categoryLabel, Range(previousRange.second, categoryEndValue)); | |
100 | d->m_categories.append(categoryLabel); |
|
100 | d->m_categories.append(categoryLabel); | |
101 | } |
|
101 | } | |
102 | } |
|
102 | } |
General Comments 0
You need to be logged in to leave comments.
Login now