##// END OF EJS Templates
added stacked bar chart
added stacked bar chart

File last commit:

r94:6732dc48e5e9
r94:6732dc48e5e9
Show More
bargroup.h
54 lines | 1.4 KiB | text/x-c | CLexer
sauimone
added stacked bar chart
r94 #ifndef QBARGROUP_H
#define QBARGROUP_H
sauimone
Integrating bar chart. Cleaned up old implementation. TODO: show this in test application. how?
r56
sauimone
BarGroup and Bar as ChartItems instead of GraphicItems
r74 #include "chartitem_p.h"
sauimone
Integrating bar chart. Cleaned up old implementation. TODO: show this in test application. how?
r56 #include "bar.h"
#include "barchartseries.h"
QTCOMMERCIALCHART_BEGIN_NAMESPACE
sauimone
BarGroup and Bar as ChartItems instead of GraphicItems
r74 class BarGroup : public ChartItem
sauimone
Integrating bar chart. Cleaned up old implementation. TODO: show this in test application. how?
r56 {
public:
sauimone
Added bar chart example
r78 explicit BarGroup(BarChartSeries& series, QGraphicsItem *parent = 0);
// From ChartItem
virtual void setSize(const QSize& size);
virtual void setPlotDomain(const PlotDomain& data);
sauimone
Integrating bar chart. Cleaned up old implementation. TODO: show this in test application. how?
r56
// Layout "api"
void setPos(qreal x, qreal y);
void setBarWidth( int w ); // Default width for each bar
sauimone
correct drawing for barchart
r82
int addColor( QColor color );
sauimone
reset colors for barchart
r92 void resetColors();
sauimone
Integrating bar chart. Cleaned up old implementation. TODO: show this in test application. how?
r56
// From QGraphicsItem
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
QRectF boundingRect() const;
private:
void dataChanged(); // data of series has changed -> need to recalculate bar sizes
void layoutChanged(); // layout has changed -> need to recalculate bar sizes
private:
// Data
BarChartSeries& mSeries;
int mMin; // Min and max values of data. (updated when data is changed, used when drawing)
int mMax;
int mHeight; // Layout spesific
int mWidth;
int mBarDefaultWidth;
bool mLayoutSet; // True, if component has been laid out.
bool mLayoutDirty;
sauimone
correct drawing for barchart
r82 QList<QColor> mColors; // List of colors for series for now
sauimone
Integrating bar chart. Cleaned up old implementation. TODO: show this in test application. how?
r56 };
QTCOMMERCIALCHART_END_NAMESPACE
sauimone
added stacked bar chart
r94 #endif // QBARGROUP_H