From a05112f857cf29688ded39f122b87daf2e9ee9d6 2012-03-29 08:36:17 From: Michal Klocek Date: 2012-03-29 08:36:17 Subject: [PATCH] Bugfix: floating 0 in axi labels --- diff --git a/src/axis/axisitem.cpp b/src/axis/axisitem.cpp index c74f937..8f8783a 100644 --- a/src/axis/axisitem.cpp +++ b/src/axis/axisitem.cpp @@ -273,12 +273,12 @@ void Axis::setLayout(QVector &layout) QGraphicsLineItem *lineItem = static_cast(lines.at(i)); lineItem->setLine(layout[i], m_rect.top(), layout[i], m_rect.bottom()); QGraphicsSimpleTextItem *labelItem = static_cast(labels.at(i)); - if (!categories) { + if (!categories || i<1) { labelItem->setText(ticksList.at(i)); QPointF center = labelItem->boundingRect().center(); labelItem->setTransformOriginPoint(center.x(), center.y()); labelItem->setPos(layout[i] - center.x(), m_rect.bottom() + label_padding); - } else if(i>0) { + } else { labelItem->setText(ticksList.at(i)); QPointF center = labelItem->boundingRect().center(); labelItem->setTransformOriginPoint(center.x(), center.y()); @@ -305,12 +305,12 @@ void Axis::setLayout(QVector &layout) lineItem->setLine(m_rect.left() , layout[i], m_rect.right(), layout[i]); QGraphicsSimpleTextItem *labelItem = static_cast(labels.at(i)); - if (!categories) { + if (!categories || i<1) { labelItem->setText(ticksList.at(i)); QPointF center = labelItem->boundingRect().center(); labelItem->setTransformOriginPoint(center.x(), center.y()); labelItem->setPos(m_rect.left() - labelItem->boundingRect().width() - label_padding , layout[i]-center.y()); - } else if (i>0) { + } else { labelItem->setText(ticksList.at(i)); QPointF center = labelItem->boundingRect().center(); labelItem->setTransformOriginPoint(center.x(), center.y());