Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef QWT_PLOT_MULTI_BAR_CHART_H
00011 #define QWT_PLOT_MULTI_BAR_CHART_H
00012
00013 #include "qwt_global.h"
00014 #include "qwt_plot_abstract_barchart.h"
00015 #include "qwt_series_data.h"
00016
00017 class QwtColumnRect;
00018 class QwtColumnSymbol;
00019
00041 class QWT_EXPORT QwtPlotMultiBarChart:
00042 public QwtPlotAbstractBarChart, public QwtSeriesStore<QwtSetSample>
00043 {
00044 public:
00051 enum ChartStyle
00052 {
00054 Grouped,
00055
00061 Stacked
00062 };
00063
00064 explicit QwtPlotMultiBarChart( const QString &title = QString::null );
00065 explicit QwtPlotMultiBarChart( const QwtText &title );
00066
00067 virtual ~QwtPlotMultiBarChart();
00068
00069 virtual int rtti() const;
00070
00071 void setBarTitles( const QList<QwtText> & );
00072 QList<QwtText> barTitles() const;
00073
00074 void setSamples( const QVector<QwtSetSample> & );
00075 void setSamples( const QVector< QVector<double> > & );
00076 void setSamples( QwtSeriesData<QwtSetSample> * );
00077
00078 void setStyle( ChartStyle style );
00079 ChartStyle style() const;
00080
00081 void setSymbol( int barIndex, QwtColumnSymbol *symbol );
00082 const QwtColumnSymbol *symbol( int barIndex ) const;
00083
00084 void resetSymbolMap();
00085
00086 virtual void drawSeries( QPainter *painter,
00087 const QwtScaleMap &xMap, const QwtScaleMap &yMap,
00088 const QRectF &canvasRect, int from, int to ) const;
00089
00090 virtual QRectF boundingRect() const;
00091
00092 virtual QList<QwtLegendData> legendData() const;
00093
00094 virtual QwtGraphic legendIcon( int index, const QSizeF & ) const;
00095
00096 protected:
00097 QwtColumnSymbol *symbol( int barIndex );
00098
00099 virtual QwtColumnSymbol *specialSymbol(
00100 int sampleIndex, int valueIndex ) const;
00101
00102 virtual void drawSample( QPainter *painter,
00103 const QwtScaleMap &xMap, const QwtScaleMap &yMap,
00104 const QRectF &canvasRect, const QwtInterval &boundingInterval,
00105 int index, const QwtSetSample& sample ) const;
00106
00107 virtual void drawBar( QPainter *, int sampleIndex,
00108 int barIndex, const QwtColumnRect & ) const;
00109
00110 void drawStackedBars( QPainter *painter,
00111 const QwtScaleMap &xMap, const QwtScaleMap &yMap,
00112 const QRectF &canvasRect, int index,
00113 double sampleWidth, const QwtSetSample& sample ) const;
00114
00115 void drawGroupedBars( QPainter *painter,
00116 const QwtScaleMap &xMap, const QwtScaleMap &yMap,
00117 const QRectF &canvasRect, int index,
00118 double sampleWidth, const QwtSetSample& sample ) const;
00119
00120 private:
00121 void init();
00122
00123 class PrivateData;
00124 PrivateData *d_data;
00125 };
00126
00127 #endif