##// END OF EJS Templates
drawing fix for bar chart
sauimone -
r83:1b872afb5c9f
parent child
Show More
@@ -42,6 +42,7 void Bar::setPos(qreal x, qreal y)
42 void Bar::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
42 void Bar::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
43 {
43 {
44 if (0 == mHeight) {
44 if (0 == mHeight) {
45 // Nothing to draw
45 return;
46 return;
46 }
47 }
47 // Set color for bar. TODO: gradients, textures etc
48 // Set color for bar. TODO: gradients, textures etc
@@ -51,10 +52,8 void Bar::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidg
51 painter->setPen(pen);
52 painter->setPen(pen);
52
53
53 // Draw bar
54 // Draw bar
54 // TODO: Pen width affects bar height for now. This should be rect
55 painter->drawLine(mXpos, mYpos ,
55 // painter->drawRect(mXpos,mYpos,mWidth,mHeight);
56 mXpos, mYpos - mHeight);
56 painter->drawLine(mXpos, mYpos + mHeight - mWidth,
57 mXpos, mYpos + mWidth);
58 }
57 }
59
58
60 QRectF Bar::boundingRect() const
59 QRectF Bar::boundingRect() const
@@ -128,7 +128,8 void BarGroup::layoutChanged()
128 bar->setColor(mColors.at(series));
128 bar->setColor(mColors.at(series));
129
129
130 // TODO: bar width shouldn't affect height. Currently it does because pen width also affects height. (QPainter thingy...)
130 // TODO: bar width shouldn't affect height. Currently it does because pen width also affects height. (QPainter thingy...)
131 bar->setPos(item*posStep+startPos + series * mBarDefaultWidth, mHeight - barHeight + mBarDefaultWidth);
131 // bar->setPos(item*posStep+startPos + series * mBarDefaultWidth, mHeight - barHeight);
132 bar->setPos(item*posStep+startPos + series * mBarDefaultWidth, mHeight);
132 itemIndex++;
133 itemIndex++;
133 }
134 }
134 }
135 }
General Comments 0
You need to be logged in to leave comments. Login now