Qwt User's Guide  6.1.1
 All Classes Functions Variables Typedefs Enumerations Enumerator Pages
qwt_plot_histogram.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_HISTOGRAM_H
11 #define QWT_PLOT_HISTOGRAM_H
12 
13 #include "qwt_global.h"
14 #include "qwt_plot_seriesitem.h"
15 #include "qwt_column_symbol.h"
16 #include <qcolor.h>
17 #include <qvector.h>
18 
19 class QwtIntervalData;
20 class QString;
21 class QPolygonF;
22 
39 class QWT_EXPORT QwtPlotHistogram:
40  public QwtPlotSeriesItem, public QwtSeriesStore<QwtIntervalSample>
41 {
42 public:
50  {
58 
65 
70 
76  UserStyle = 100
77  };
78 
79  explicit QwtPlotHistogram( const QString &title = QString::null );
80  explicit QwtPlotHistogram( const QwtText &title );
81  virtual ~QwtPlotHistogram();
82 
83  virtual int rtti() const;
84 
85  void setPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
86  void setPen( const QPen & );
87  const QPen &pen() const;
88 
89  void setBrush( const QBrush & );
90  const QBrush &brush() const;
91 
92  void setSamples( const QVector<QwtIntervalSample> & );
93  void setSamples( QwtSeriesData<QwtIntervalSample> * );
94 
95  void setBaseline( double reference );
96  double baseline() const;
97 
98  void setStyle( HistogramStyle style );
99  HistogramStyle style() const;
100 
101  void setSymbol( const QwtColumnSymbol * );
102  const QwtColumnSymbol *symbol() const;
103 
104  virtual void drawSeries( QPainter *p,
105  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
106  const QRectF &canvasRect, int from, int to ) const;
107 
108  virtual QRectF boundingRect() const;
109 
110  virtual QwtGraphic legendIcon( int index, const QSizeF & ) const;
111 
112 protected:
113  virtual QwtColumnRect columnRect( const QwtIntervalSample &,
114  const QwtScaleMap &, const QwtScaleMap & ) const;
115 
116  virtual void drawColumn( QPainter *, const QwtColumnRect &,
117  const QwtIntervalSample & ) const;
118 
119  void drawColumns( QPainter *,
120  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
121  int from, int to ) const;
122 
123  void drawOutline( QPainter *,
124  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
125  int from, int to ) const;
126 
127  void drawLines( QPainter *,
128  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
129  int from, int to ) const;
130 
131 private:
132  void init();
133  void flushPolygon( QPainter *, double baseLine, QPolygonF & ) const;
134 
135  class PrivateData;
136  PrivateData *d_data;
137 };
138 
139 #endif
Definition: qwt_plot_histogram.h:57
virtual QRectF boundingRect() const
Definition: qwt_plot_seriesitem.cpp:94
Definition: qwt_plot_histogram.h:64
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
HistogramStyle
Definition: qwt_plot_histogram.h:49
Directed rectangle representing bounding rectangle and orientation of a column.
Definition: qwt_column_symbol.h:28
QwtPlotHistogram represents a series of samples, where an interval is associated with a value ( )...
Definition: qwt_plot_histogram.h:39
virtual int rtti() const
Definition: qwt_plot_item.cpp:120
A drawing primitive for columns.
Definition: qwt_column_symbol.h:93
Class storing a QwtSeriesData object.
Definition: qwt_series_store.h:57
Base class for plot items representing a series of samples.
Definition: qwt_plot_seriesitem.h:22
A sample of the types (x1-x2, y) or (x, y1-y2)
Definition: qwt_samples.h:19
Definition: qwt_plot_histogram.h:69
A paint device for scalable graphics.
Definition: qwt_graphic.h:74
virtual void drawSeries(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const =0