@@ -164,7 +164,13 void HorizontalAxis::updateGeometry() | |||||
164 | //shades |
|
164 | //shades | |
165 | if ((i + 1) % 2 && i > 1) { |
|
165 | if ((i + 1) % 2 && i > 1) { | |
166 | QGraphicsRectItem *rectItem = static_cast<QGraphicsRectItem *>(shades.at(i / 2 - 1)); |
|
166 | QGraphicsRectItem *rectItem = static_cast<QGraphicsRectItem *>(shades.at(i / 2 - 1)); | |
167 | rectItem->setRect(layout[i - 1], gridRect.top(), layout[i] - layout[i - 1], gridRect.height()); |
|
167 | qreal leftBound = qMax(layout[i - 1], gridRect.left()); | |
|
168 | qreal rightBound = qMin(layout[i], gridRect.right()); | |||
|
169 | rectItem->setRect(leftBound, gridRect.top(), rightBound - leftBound, gridRect.height()); | |||
|
170 | if (rectItem->rect().width() <= 0.0) | |||
|
171 | rectItem->setVisible(false); | |||
|
172 | else | |||
|
173 | rectItem->setVisible(true); | |||
168 | } |
|
174 | } | |
169 |
|
175 | |||
170 | // check if the grid line and the axis tick should be shown |
|
176 | // check if the grid line and the axis tick should be shown |
@@ -175,7 +175,13 void VerticalAxis::updateGeometry() | |||||
175 | //shades |
|
175 | //shades | |
176 | if ((i + 1) % 2 && i > 1) { |
|
176 | if ((i + 1) % 2 && i > 1) { | |
177 | QGraphicsRectItem *rectItem = static_cast<QGraphicsRectItem *>(shades.at(i / 2 - 1)); |
|
177 | QGraphicsRectItem *rectItem = static_cast<QGraphicsRectItem *>(shades.at(i / 2 - 1)); | |
178 | rectItem->setRect(gridRect.left(), layout[i], gridRect.width(), layout[i - 1] - layout[i]); |
|
178 | qreal lowerBound = qMin(layout[i - 1], gridRect.bottom()); | |
|
179 | qreal upperBound = qMax(layout[i], gridRect.top()); | |||
|
180 | rectItem->setRect(gridRect.left(), upperBound, gridRect.width(), lowerBound - upperBound); | |||
|
181 | if (rectItem->rect().height() <= 0.0) | |||
|
182 | rectItem->setVisible(false); | |||
|
183 | else | |||
|
184 | rectItem->setVisible(true); | |||
179 | } |
|
185 | } | |
180 |
|
186 | |||
181 | // check if the grid line and the axis tick should be shown |
|
187 | // check if the grid line and the axis tick should be shown |
General Comments 0
You need to be logged in to leave comments.
Login now