##// END OF EJS Templates
Draw the tick and label on logaxis when tick is exactly at high edge...
Miikka Heikkinen -
r2837:e6f5cbaa5aca
parent child
Show More
@@ -49,6 +49,11 QVector<qreal> ChartLogValueAxisX::calculateLayout() const
49 qreal ceilEdge = qCeil(leftEdge);
49 qreal ceilEdge = qCeil(leftEdge);
50 int tickCount = qAbs(qCeil(logMax) - qCeil(logMin));
50 int tickCount = qAbs(qCeil(logMax) - qCeil(logMin));
51
51
52 // If the high edge sits exactly on the tick value, add a tick
53 qreal highValue = logMin < logMax ? logMax : logMin;
54 if (qFuzzyCompare(highValue, qreal(qCeil(highValue))))
55 tickCount++;
56
52 points.resize(tickCount);
57 points.resize(tickCount);
53 const QRectF &gridRect = gridGeometry();
58 const QRectF &gridRect = gridGeometry();
54 const qreal deltaX = gridRect.width() / qAbs(logMax - logMin);
59 const qreal deltaX = gridRect.width() / qAbs(logMax - logMin);
@@ -90,6 +95,12 QSizeF ChartLogValueAxisX::sizeHint(Qt::SizeHint which, const QSizeF &constraint
90 qreal logMax = std::log10(m_axis->max()) / std::log10(m_axis->base());
95 qreal logMax = std::log10(m_axis->max()) / std::log10(m_axis->base());
91 qreal logMin = std::log10(m_axis->min()) / std::log10(m_axis->base());
96 qreal logMin = std::log10(m_axis->min()) / std::log10(m_axis->base());
92 int tickCount = qAbs(qCeil(logMax) - qCeil(logMin));
97 int tickCount = qAbs(qCeil(logMax) - qCeil(logMin));
98
99 // If the high edge sits exactly on the tick value, add a tick
100 qreal highValue = logMin < logMax ? logMax : logMin;
101 if (qFuzzyCompare(highValue, qreal(qCeil(highValue))))
102 tickCount++;
103
93 if (m_axis->max() > m_axis->min() && tickCount > 0)
104 if (m_axis->max() > m_axis->min() && tickCount > 0)
94 ticksList = createLogValueLabels(m_axis->min(), m_axis->max(), m_axis->base(), tickCount, m_axis->labelFormat());
105 ticksList = createLogValueLabels(m_axis->min(), m_axis->max(), m_axis->base(), tickCount, m_axis->labelFormat());
95 else
106 else
@@ -48,6 +48,11 QVector<qreal> ChartLogValueAxisY::calculateLayout() const
48 qreal ceilEdge = qCeil(leftEdge);
48 qreal ceilEdge = qCeil(leftEdge);
49 int tickCount = qAbs(qCeil(logMax) - qCeil(logMin));
49 int tickCount = qAbs(qCeil(logMax) - qCeil(logMin));
50
50
51 // If the high edge sits exactly on the tick value, add a tick
52 qreal highValue = logMin < logMax ? logMax : logMin;
53 if (qFuzzyCompare(highValue, qreal(qCeil(highValue))))
54 tickCount++;
55
51 points.resize(tickCount);
56 points.resize(tickCount);
52 const QRectF &gridRect = gridGeometry();
57 const QRectF &gridRect = gridGeometry();
53 const qreal deltaY = gridRect.height() / qAbs(logMax - logMin);
58 const qreal deltaY = gridRect.height() / qAbs(logMax - logMin);
@@ -90,6 +95,12 QSizeF ChartLogValueAxisY::sizeHint(Qt::SizeHint which, const QSizeF &constraint
90 qreal logMax = std::log10(m_axis->max()) / std::log10(m_axis->base());
95 qreal logMax = std::log10(m_axis->max()) / std::log10(m_axis->base());
91 qreal logMin = std::log10(m_axis->min()) / std::log10(m_axis->base());
96 qreal logMin = std::log10(m_axis->min()) / std::log10(m_axis->base());
92 int tickCount = qAbs(qCeil(logMax) - qCeil(logMin));
97 int tickCount = qAbs(qCeil(logMax) - qCeil(logMin));
98
99 // If the high edge sits exactly on the tick value, add a tick
100 qreal highValue = logMin < logMax ? logMax : logMin;
101 if (qFuzzyCompare(highValue, qreal(qCeil(highValue))))
102 tickCount++;
103
93 if (m_axis->max() > m_axis->min() && tickCount > 0)
104 if (m_axis->max() > m_axis->min() && tickCount > 0)
94 ticksList = createLogValueLabels(m_axis->min(), m_axis->max(), m_axis->base(), tickCount, m_axis->labelFormat());
105 ticksList = createLogValueLabels(m_axis->min(), m_axis->max(), m_axis->base(), tickCount, m_axis->labelFormat());
95 else
106 else
General Comments 0
You need to be logged in to leave comments. Login now