@@ -37,14 +37,12 void HorizontalAxis::updateGeometry() | |||
|
37 | 37 | { |
|
38 | 38 | const QVector<qreal> &layout = ChartAxisElement::layout(); |
|
39 | 39 | |
|
40 | if (layout.isEmpty()) | |
|
40 | if (layout.isEmpty() && axis()->type() != QAbstractAxis::AxisTypeLogValue) | |
|
41 | 41 | return; |
|
42 | 42 | |
|
43 | 43 | QStringList labelList = labels(); |
|
44 | 44 | |
|
45 | QList<QGraphicsItem *> lines = gridItems(); | |
|
46 | 45 | QList<QGraphicsItem *> labels = labelItems(); |
|
47 | QList<QGraphicsItem *> shades = shadeItems(); | |
|
48 | 46 | QList<QGraphicsItem *> arrow = arrowItems(); |
|
49 | 47 | QGraphicsTextItem *title = titleItem(); |
|
50 | 48 | |
@@ -90,6 +88,12 void HorizontalAxis::updateGeometry() | |||
|
90 | 88 | availableSpace -= titleBoundingRect.height(); |
|
91 | 89 | } |
|
92 | 90 | |
|
91 | if (layout.isEmpty() && axis()->type() == QAbstractAxis::AxisTypeLogValue) | |
|
92 | return; | |
|
93 | ||
|
94 | QList<QGraphicsItem *> lines = gridItems(); | |
|
95 | QList<QGraphicsItem *> shades = shadeItems(); | |
|
96 | ||
|
93 | 97 | for (int i = 0; i < layout.size(); ++i) { |
|
94 | 98 | //items |
|
95 | 99 | QGraphicsLineItem *gridItem = static_cast<QGraphicsLineItem*>(lines.at(i)); |
@@ -48,10 +48,10 QVector<qreal> ChartLogValueAxisX::calculateLayout() const | |||
|
48 | 48 | qreal ceilEdge = ceil(leftEdge); |
|
49 | 49 | int tickCount = qAbs(ceil(logMax) - ceil(logMin)); |
|
50 | 50 | |
|
51 |
points.resize(tickCount |
|
|
51 | points.resize(tickCount); | |
|
52 | 52 | const QRectF &gridRect = gridGeometry(); |
|
53 | 53 | const qreal deltaX = gridRect.width() / qAbs(logMax - logMin); |
|
54 |
for (int i = 0; i < |
|
|
54 | for (int i = 0; i < tickCount; ++i) | |
|
55 | 55 | points[i] = (ceilEdge + qreal(i)) * deltaX - leftEdge * deltaX + gridRect.left(); |
|
56 | 56 | |
|
57 | 57 | return points; |
@@ -60,8 +60,6 QVector<qreal> ChartLogValueAxisX::calculateLayout() const | |||
|
60 | 60 | void ChartLogValueAxisX::updateGeometry() |
|
61 | 61 | { |
|
62 | 62 | const QVector<qreal>& layout = ChartAxisElement::layout(); |
|
63 | if (layout.isEmpty()) | |
|
64 | return; | |
|
65 | 63 | setLabels(createLogValueLabels(m_axis->min(), m_axis->max(), m_axis->base(), layout.size(), m_axis->labelFormat())); |
|
66 | 64 | HorizontalAxis::updateGeometry(); |
|
67 | 65 | } |
@@ -47,10 +47,10 QVector<qreal> ChartLogValueAxisY::calculateLayout() const | |||
|
47 | 47 | qreal ceilEdge = ceil(leftEdge); |
|
48 | 48 | int tickCount = qAbs(ceil(logMax) - ceil(logMin)); |
|
49 | 49 | |
|
50 |
points.resize(tickCount |
|
|
50 | points.resize(tickCount); | |
|
51 | 51 | const QRectF &gridRect = gridGeometry(); |
|
52 | 52 | const qreal deltaY = gridRect.height() / qAbs(logMax - logMin); |
|
53 |
for (int i = 0; i < |
|
|
53 | for (int i = 0; i < tickCount; ++i) | |
|
54 | 54 | points[i] = (ceilEdge + qreal(i)) * -deltaY - leftEdge * -deltaY + gridRect.bottom(); |
|
55 | 55 | |
|
56 | 56 | return points; |
@@ -60,8 +60,6 QVector<qreal> ChartLogValueAxisY::calculateLayout() const | |||
|
60 | 60 | void ChartLogValueAxisY::updateGeometry() |
|
61 | 61 | { |
|
62 | 62 | const QVector<qreal> &layout = ChartAxisElement::layout(); |
|
63 | if (layout.isEmpty()) | |
|
64 | return; | |
|
65 | 63 | setLabels(createLogValueLabels(m_axis->min(), m_axis->max(), m_axis->base(), layout.size(), m_axis->labelFormat())); |
|
66 | 64 | VerticalAxis::updateGeometry(); |
|
67 | 65 | } |
@@ -36,14 +36,12 void VerticalAxis::updateGeometry() | |||
|
36 | 36 | { |
|
37 | 37 | const QVector<qreal> &layout = ChartAxisElement::layout(); |
|
38 | 38 | |
|
39 | if (layout.isEmpty()) | |
|
39 | if (layout.isEmpty() && axis()->type() != QAbstractAxis::AxisTypeLogValue) | |
|
40 | 40 | return; |
|
41 | 41 | |
|
42 | 42 | QStringList labelList = labels(); |
|
43 | 43 | |
|
44 | QList<QGraphicsItem *> lines = gridItems(); | |
|
45 | 44 | QList<QGraphicsItem *> labels = labelItems(); |
|
46 | QList<QGraphicsItem *> shades = shadeItems(); | |
|
47 | 45 | QList<QGraphicsItem *> arrow = arrowItems(); |
|
48 | 46 | QGraphicsTextItem *title = titleItem(); |
|
49 | 47 | |
@@ -55,7 +53,6 void VerticalAxis::updateGeometry() | |||
|
55 | 53 | |
|
56 | 54 | qreal height = axisRect.bottom(); |
|
57 | 55 | |
|
58 | ||
|
59 | 56 | //arrow |
|
60 | 57 | QGraphicsLineItem *arrowItem = static_cast<QGraphicsLineItem*>(arrow.at(0)); |
|
61 | 58 | |
@@ -93,6 +90,12 void VerticalAxis::updateGeometry() | |||
|
93 | 90 | availableSpace -= titleBoundingRect.height(); |
|
94 | 91 | } |
|
95 | 92 | |
|
93 | if (layout.isEmpty() && axis()->type() == QAbstractAxis::AxisTypeLogValue) | |
|
94 | return; | |
|
95 | ||
|
96 | QList<QGraphicsItem *> lines = gridItems(); | |
|
97 | QList<QGraphicsItem *> shades = shadeItems(); | |
|
98 | ||
|
96 | 99 | for (int i = 0; i < layout.size(); ++i) { |
|
97 | 100 | //items |
|
98 | 101 | QGraphicsLineItem *gridItem = static_cast<QGraphicsLineItem *>(lines.at(i)); |
General Comments 0
You need to be logged in to leave comments.
Login now