@@ -293,24 +293,19 void HorizontalAxis::updateGeometry() | |||||
293 | int minorTickCount = valueAxis->minorTickCount(); |
|
293 | int minorTickCount = valueAxis->minorTickCount(); | |
294 | if (minorTickCount != 0) { |
|
294 | if (minorTickCount != 0) { | |
295 | qreal minorTickDistance = (layout[i] - layout[i + 1]) / qreal(minorTickCount + 1); |
|
295 | qreal minorTickDistance = (layout[i] - layout[i + 1]) / qreal(minorTickCount + 1); | |
|
296 | if (axis()->isReverse()) | |||
|
297 | minorTickDistance = -minorTickDistance; | |||
296 | for (int j = 0; j < minorTickCount; j++) { |
|
298 | for (int j = 0; j < minorTickCount; j++) { | |
297 | QGraphicsLineItem *minorGridItem = |
|
299 | QGraphicsLineItem *minorGridItem = | |
298 | static_cast<QGraphicsLineItem *>(minorLines.at(i * minorTickCount + j)); |
|
300 | static_cast<QGraphicsLineItem *>(minorLines.at(i * minorTickCount + j)); | |
299 | QGraphicsLineItem *minorArrowItem = |
|
301 | QGraphicsLineItem *minorArrowItem = | |
300 | static_cast<QGraphicsLineItem *>(minorArrows.at(i * minorTickCount + j)); |
|
302 | static_cast<QGraphicsLineItem *>(minorArrows.at(i * minorTickCount + j)); | |
301 | if (i == 0) { |
|
303 | minorGridItem->setLine(gridItem->line().p1().x() | |
302 |
|
|
304 | - minorTickDistance * qreal(j + 1), | |
303 |
|
|
305 | gridRect.top(), | |
304 |
|
|
306 | gridItem->line().p1().x() | |
305 |
|
|
307 | - minorTickDistance * qreal(j + 1), | |
306 | } else { |
|
308 | gridRect.bottom()); | |
307 | minorGridItem->setLine(gridItem->line().p1().x() |
|
|||
308 | - minorTickDistance * qreal(j + 1), |
|
|||
309 | gridRect.top(), |
|
|||
310 | gridItem->line().p1().x() |
|
|||
311 | - minorTickDistance * qreal(j + 1), |
|
|||
312 | gridRect.bottom()); |
|
|||
313 | } |
|
|||
314 | if (axis()->alignment() == Qt::AlignTop) { |
|
309 | if (axis()->alignment() == Qt::AlignTop) { | |
315 | minorArrowItem->setLine(minorGridItem->line().p1().x(), |
|
310 | minorArrowItem->setLine(minorGridItem->line().p1().x(), | |
316 | axisRect.bottom(), |
|
311 | axisRect.bottom(), |
@@ -309,24 +309,19 void VerticalAxis::updateGeometry() | |||||
309 | int minorTickCount = valueAxis->minorTickCount(); |
|
309 | int minorTickCount = valueAxis->minorTickCount(); | |
310 | if (minorTickCount != 0) { |
|
310 | if (minorTickCount != 0) { | |
311 | qreal minorTickDistance = (layout[i] - layout[i + 1]) / qreal(minorTickCount + 1); |
|
311 | qreal minorTickDistance = (layout[i] - layout[i + 1]) / qreal(minorTickCount + 1); | |
|
312 | if (axis()->isReverse()) | |||
|
313 | minorTickDistance = -minorTickDistance; | |||
312 | for (int j = 0; j < minorTickCount; j++) { |
|
314 | for (int j = 0; j < minorTickCount; j++) { | |
313 | QGraphicsLineItem *minorGridItem = |
|
315 | QGraphicsLineItem *minorGridItem = | |
314 | static_cast<QGraphicsLineItem *>(minorLines.at(i * minorTickCount + j)); |
|
316 | static_cast<QGraphicsLineItem *>(minorLines.at(i * minorTickCount + j)); | |
315 | QGraphicsLineItem *minorArrowItem = |
|
317 | QGraphicsLineItem *minorArrowItem = | |
316 | static_cast<QGraphicsLineItem *>(minorArrows.at(i * minorTickCount + j)); |
|
318 | static_cast<QGraphicsLineItem *>(minorArrows.at(i * minorTickCount + j)); | |
317 | if (i == 0) { |
|
319 | minorGridItem->setLine(gridRect.left(), | |
318 |
|
|
320 | gridItem->line().p1().y() | |
319 |
|
|
321 | - minorTickDistance * qreal(j + 1), | |
320 |
|
|
322 | gridRect.right(), | |
321 |
|
|
323 | gridItem->line().p1().y() | |
322 | } else { |
|
324 | - minorTickDistance * qreal(j + 1)); | |
323 | minorGridItem->setLine(gridRect.left(), |
|
|||
324 | gridItem->line().p1().y() |
|
|||
325 | - minorTickDistance * qreal(j + 1), |
|
|||
326 | gridRect.right(), |
|
|||
327 | gridItem->line().p1().y() |
|
|||
328 | - minorTickDistance * qreal(j + 1)); |
|
|||
329 | } |
|
|||
330 | if (axis()->alignment() == Qt::AlignLeft) { |
|
325 | if (axis()->alignment() == Qt::AlignLeft) { | |
331 | minorArrowItem->setLine(gridRect.left() - labelPadding() / 2, |
|
326 | minorArrowItem->setLine(gridRect.left() - labelPadding() / 2, | |
332 | minorGridItem->line().p1().y(), |
|
327 | minorGridItem->line().p1().y(), |
General Comments 0
You need to be logged in to leave comments.
Login now