Qwt User's Guide 6.0.2

- Main Page
- Related Pages
- Classes

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
37 class QWT_EXPORT QwtPlotHistogram: public QwtPlotSeriesItem<QwtIntervalSample>
38 {
39 public:
46 enum HistogramStyle
47 {
54 Outline,
55
61 Columns,
62
66 Lines,
67
73 UserStyle = 100
74 };
75
76 explicit QwtPlotHistogram( const QString &title = QString::null );
77 explicit QwtPlotHistogram( const QwtText &title );
78 virtual ~QwtPlotHistogram();
79
80 virtual int rtti() const;
81
82 void setPen( const QPen & );
83 const QPen &pen() const;
84
85 void setBrush( const QBrush & );
86 const QBrush &brush() const;
87
88 void setSamples( const QVector<QwtIntervalSample> & );
89
90 void setBaseline( double reference );
91 double baseline() const;
92
93 void setStyle( HistogramStyle style );
94 HistogramStyle style() const;
95
96 void setSymbol( const QwtColumnSymbol * );
97 const QwtColumnSymbol *symbol() const;
98
99 virtual void drawSeries( QPainter *p,
100 const QwtScaleMap &xMap, const QwtScaleMap &yMap,
101 const QRectF &canvasRect, int from, int to ) const;
102
103 virtual QRectF boundingRect() const;
104
105 virtual void drawLegendIdentifier( QPainter *, const QRectF & ) const;
106
107 protected:
108 virtual QwtColumnRect columnRect( const QwtIntervalSample &,
109 const QwtScaleMap &, const QwtScaleMap & ) const;
110
111 virtual void drawColumn( QPainter *, const QwtColumnRect &,
112 const QwtIntervalSample & ) const;
113
114 void drawColumns( QPainter *,
115 const QwtScaleMap &xMap, const QwtScaleMap &yMap,
116 int from, int to ) const;
117
118 void drawOutline( QPainter *,
119 const QwtScaleMap &xMap, const QwtScaleMap &yMap,
120 int from, int to ) const;
121
122 void drawLines( QPainter *,
123 const QwtScaleMap &xMap, const QwtScaleMap &yMap,
124 int from, int to ) const;
125
126 private:
127 void init();
128 void flushPolygon( QPainter *, double baseLine, QPolygonF & ) const;
129
130 class PrivateData;
131 PrivateData *d_data;
132 };
133
134 #endif