Qwt User's Guide  6.1.3
qwt_plot_multi_barchart.h
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2  * Qwt Widget Library
3  * Copyright (C) 1997 Josef Wilgen
4  * Copyright (C) 2002 Uwe Rathmann
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the Qwt License, Version 1.0
8  *****************************************************************************/
9 
10 #ifndef QWT_PLOT_MULTI_BAR_CHART_H
11 #define QWT_PLOT_MULTI_BAR_CHART_H
12 
13 #include "qwt_global.h"
14 #include "qwt_plot_abstract_barchart.h"
15 #include "qwt_series_data.h"
16 
17 class QwtColumnRect;
18 class QwtColumnSymbol;
19 
41 class QWT_EXPORT QwtPlotMultiBarChart:
42  public QwtPlotAbstractBarChart, public QwtSeriesStore<QwtSetSample>
43 {
44 public:
52  {
55 
61  Stacked
62  };
63 
64  explicit QwtPlotMultiBarChart( const QString &title = QString::null );
65  explicit QwtPlotMultiBarChart( const QwtText &title );
66 
67  virtual ~QwtPlotMultiBarChart();
68 
69  virtual int rtti() const;
70 
71  void setBarTitles( const QList<QwtText> & );
72  QList<QwtText> barTitles() const;
73 
74  void setSamples( const QVector<QwtSetSample> & );
75  void setSamples( const QVector< QVector<double> > & );
76  void setSamples( QwtSeriesData<QwtSetSample> * );
77 
78  void setStyle( ChartStyle style );
79  ChartStyle style() const;
80 
81  void setSymbol( int barIndex, QwtColumnSymbol *symbol );
82  const QwtColumnSymbol *symbol( int barIndex ) const;
83 
84  void resetSymbolMap();
85 
86  virtual void drawSeries( QPainter *painter,
87  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
88  const QRectF &canvasRect, int from, int to ) const;
89 
90  virtual QRectF boundingRect() const;
91 
92  virtual QList<QwtLegendData> legendData() const;
93 
94  virtual QwtGraphic legendIcon( int index, const QSizeF & ) const;
95 
96 protected:
97  QwtColumnSymbol *symbol( int barIndex );
98 
99  virtual QwtColumnSymbol *specialSymbol(
100  int sampleIndex, int valueIndex ) const;
101 
102  virtual void drawSample( QPainter *painter,
103  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
104  const QRectF &canvasRect, const QwtInterval &boundingInterval,
105  int index, const QwtSetSample& sample ) const;
106 
107  virtual void drawBar( QPainter *, int sampleIndex,
108  int barIndex, const QwtColumnRect & ) const;
109 
110  void drawStackedBars( QPainter *painter,
111  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
112  const QRectF &canvasRect, int index,
113  double sampleWidth, const QwtSetSample& sample ) const;
114 
115  void drawGroupedBars( QPainter *painter,
116  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
117  const QRectF &canvasRect, int index,
118  double sampleWidth, const QwtSetSample& sample ) const;
119 
120 private:
121  void init();
122 
123  class PrivateData;
124  PrivateData *d_data;
125 };
126 
127 #endif
virtual QList< QwtLegendData > legendData() const
Return all information, that is needed to represent the item on the legend.
Definition: qwt_plot_item.cpp:595
virtual QRectF boundingRect() const
Definition: qwt_plot_seriesitem.cpp:94
ChartStyle
Chart styles.
Definition: qwt_plot_multi_barchart.h:51
A class representing a text.
Definition: qwt_text.h:51
A scale map.
Definition: qwt_scale_map.h:30
virtual QwtGraphic legendIcon(int index, const QSizeF &) const
Definition: qwt_plot_item.cpp:371
Directed rectangle representing bounding rectangle and orientation of a column.
Definition: qwt_column_symbol.h:28
virtual int rtti() const
Definition: qwt_plot_item.cpp:120
virtual void drawSeries(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const =0
A drawing primitive for columns.
Definition: qwt_column_symbol.h:93
Class storing a QwtSeriesData object.
Definition: qwt_series_store.h:57
A sample of the types (x1...xn, y) or (x, y1..yn)
Definition: qwt_samples.h:76
A paint device for scalable graphics.
Definition: qwt_graphic.h:74
QwtPlotMultiBarChart displays a series of a samples that consist each of a set of values...
Definition: qwt_plot_multi_barchart.h:41
A class representing an interval.
Definition: qwt_interval.h:26
Abstract base class for bar chart items.
Definition: qwt_plot_abstract_barchart.h:25
The bars of a set are displayed side by side.
Definition: qwt_plot_multi_barchart.h:54