##// END OF EJS Templates
added labels to series, intergrated with test app. minor hack to test app
added labels to series, intergrated with test app. minor hack to test app

File last commit:

r149:23a271e217e1
r167:023d2c8150a8
Show More
bar.cpp
62 lines | 1.2 KiB | text/x-c | CppLexer
sauimone
renamed bar.h to bar_p.h
r118 #include "bar_p.h"
sauimone
Integrating bar chart. Cleaned up old implementation. TODO: show this in test application. how?
r56 #include <QDebug>
Michal Klocek
minor.
r59 #include <QPainter>
sauimone
Integrating bar chart. Cleaned up old implementation. TODO: show this in test application. how?
r56
QTCOMMERCIALCHART_BEGIN_NAMESPACE
Tero Ahola
Refactored themes; now enabled for line, scatter and pies...
r103 Bar::Bar(QGraphicsItem *parent)
Tero Ahola
Refactoring continued: restored ChartItem class
r104 : ChartItem(parent)
sauimone
Integrating bar chart. Cleaned up old implementation. TODO: show this in test application. how?
r56 {
}
Michal Klocek
Adds layout support for charts....
r115 void Bar::setSize(const QSizeF& size)
sauimone
BarGroup and Bar as ChartItems instead of GraphicItems
r74 {
mWidth = size.width();
mHeight = size.height();
}
sauimone
theme interface to barcharts. some minor fixes
r113 void Bar::resize( qreal w, qreal h )
sauimone
Integrating bar chart. Cleaned up old implementation. TODO: show this in test application. how?
r56 {
sauimone
Some fixes to bar charts. Now bars draw almost correctly
r97 // qDebug() << "bar::resize" << w << h;
sauimone
Integrating bar chart. Cleaned up old implementation. TODO: show this in test application. how?
r56 mWidth = w;
mHeight = h;
}
void Bar::setColor( QColor col )
{
mColor = col;
}
void Bar::setPos(qreal x, qreal y)
{
sauimone
Some fixes to bar charts. Now bars draw almost correctly
r97 // qDebug() << "Bar::setpos" << x << y;
sauimone
Integrating bar chart. Cleaned up old implementation. TODO: show this in test application. how?
r56 mXpos = x;
mYpos = y;
}
void Bar::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
sauimone
correct drawing for barchart
r82 if (0 == mHeight) {
return;
}
sauimone
Some fixes to bar charts. Now bars draw almost correctly
r97 // TODO: accept brush instead of color
QBrush brush(mColor);
painter->setBrush(brush);
sauimone
theme interface to barcharts. some minor fixes
r113
// This compensates for rounding errors. drawRect takes ints and cumulative error of pos + size may be over 1.
int x0 = mXpos;
int x1 = (mXpos + mWidth);
int w = x1-x0;
int y0 = mYpos;
int y1 = (mYpos + mHeight);
int h = y1-y0;
painter->drawRect(x0, y0 ,w ,h);
sauimone
Integrating bar chart. Cleaned up old implementation. TODO: show this in test application. how?
r56 }
QRectF Bar::boundingRect() const
{
QRectF r(mXpos, mYpos, mXpos + mWidth, mYpos + mHeight);
return r;
}
QTCOMMERCIALCHART_END_NAMESPACE