Qwt User's Guide 6.2.0

qwt_plot_histogram.h
1 /******************************************************************************
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
16 class QwtColumnSymbol;
17 class QwtColumnRect;
18 class QColor;
19 class QPolygonF;
20
21 #if QT_VERSION < 0x060000
22 template< typename T > class QVector;
23 #endif
24
41 class QWT_EXPORT QwtPlotHistogram
42 : public QwtPlotSeriesItem
43 , public QwtSeriesStore< QwtIntervalSample >
44 {
45 public:
52 enum HistogramStyle
53 {
60 Outline,
61
67 Columns,
68
72 Lines,
73
79 UserStyle = 100
80 };
81
82 explicit QwtPlotHistogram( const QString& title = QString() );
83 explicit QwtPlotHistogram( const QwtText& title );
84 virtual ~QwtPlotHistogram();
85
86 virtual int rtti() const QWT_OVERRIDE;
87
88 void setPen( const QColor&,
89 qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
90
91 void setPen( const QPen& );
92 const QPen& pen() const;
93
94 void setBrush( const QBrush& );
95 const QBrush& brush() const;
96
97 void setSamples( const QVector< QwtIntervalSample >& );
98 void setSamples( QwtSeriesData< QwtIntervalSample >* );
99
100 void setBaseline( double );
101 double baseline() const;
102
103 void setStyle( HistogramStyle style );
104 HistogramStyle style() const;
105
106 void setSymbol( const QwtColumnSymbol* );
107 const QwtColumnSymbol* symbol() const;
108
109 virtual void drawSeries( QPainter*,
110 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
111 const QRectF& canvasRect, int from, int to ) const QWT_OVERRIDE;
112
113 virtual QRectF boundingRect() const QWT_OVERRIDE;
114
115 virtual QwtGraphic legendIcon(
116 int index, const QSizeF& ) const QWT_OVERRIDE;
117
118 protected:
119 virtual QwtColumnRect columnRect( const QwtIntervalSample&,
120 const QwtScaleMap&, const QwtScaleMap& ) const;
121
122 virtual void drawColumn( QPainter*, const QwtColumnRect&,
123 const QwtIntervalSample& ) const;
124
125 void drawColumns( QPainter*,
126 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
127 int from, int to ) const;
128
129 void drawOutline( QPainter*,
130 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
131 int from, int to ) const;
132
133 void drawLines( QPainter*,
134 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
135 int from, int to ) const;
136
137 private:
138 void init();
139 void flushPolygon( QPainter*, double baseLine, QPolygonF& ) const;
140
141 class PrivateData;
142 PrivateData* m_data;
143 };
144
145 #endif
QVector
Definition: qwt_clipper.h:23
QwtColumnRect
Directed rectangle representing bounding rectangle and orientation of a column.
Definition: qwt_column_symbol.h:27
QwtColumnSymbol
A drawing primitive for columns.
Definition: qwt_column_symbol.h:75
QwtGraphic
A paint device for scalable graphics.
Definition: qwt_graphic.h:76
QwtIntervalSample
A sample of the types (x1-x2, y) or (x, y1-y2)
Definition: qwt_samples.h:21
QwtPlotHistogram
QwtPlotHistogram represents a series of samples, where an interval is associated with a value ( ).
Definition: qwt_plot_histogram.h:44
QwtPlotHistogram::HistogramStyle
HistogramStyle
Definition: qwt_plot_histogram.h:53
QwtPlotHistogram::Lines
@ Lines
Definition: qwt_plot_histogram.h:72
QwtPlotHistogram::Columns
@ Columns
Definition: qwt_plot_histogram.h:67
QwtPlotHistogram::Outline
@ Outline
Definition: qwt_plot_histogram.h:60
QwtPlotItem::rtti
virtual int rtti() const
Definition: qwt_plot_item.cpp:136
QwtPlotSeriesItem
Base class for plot items representing a series of samples.
Definition: qwt_plot_seriesitem.h:26
QwtScaleMap
A scale map.
Definition: qwt_scale_map.h:27
QwtSeriesData
Abstract interface for iterating over samples.
Definition: qwt_series_data.h:50
QwtSeriesStore
Class storing a QwtSeriesData object.
Definition: qwt_series_store.h:67
QwtText
A class representing a text.
Definition: qwt_text.h:52