QWT 7.0.1
Loading...
Searching...
No Matches
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 * Modified by ChenZongYan in 2024 <czy.t@163.com>
10 * Summary of major modifications (see ChangeLog.md for full history):
11 * 1. CMake build system & C++11 throughout.
12 * 2. Core panner/ zoomer refactored:
13 * - QwtPanner → QwtCachePanner (pixmap-cache version)
14 * - New real-time QwtPlotPanner derived from QwtPicker.
15 * 3. Zoomer supports multi-axis.
16 * 4. Parasite-plot framework:
17 * - QwtFigure, QwtPlotParasiteLayout, QwtPlotTransparentCanvas,
18 * - QwtPlotScaleEventDispatcher, built-in pan/zoom on axis.
19 * 5. New picker: QwtPlotSeriesDataPicker (works with date axis).
20 * 6. Raster & color-map extensions:
21 * - QwtGridRasterData (2-D table + interpolation)
22 * - QwtLinearColorMap::stopColors(), stopPos() API rename.
23 * 7. Bar-chart: expose pen/brush control.
24 * 8. Amalgamated build: single QwtPlot.h / QwtPlot.cpp pair in src-amalgamate.
25 *****************************************************************************/
26
27#ifndef QWT_PLOT_HISTOGRAM_H
28#define QWT_PLOT_HISTOGRAM_H
29
30#include "qwt_global.h"
31#include "qwt_plot_seriesitem.h"
32
33class QwtColumnSymbol;
34class QwtColumnRect;
35class QColor;
36class QPolygonF;
37
38#if QT_VERSION < 0x060000
39template< typename T > class QVector;
40#endif
41
58class QWT_EXPORT QwtPlotHistogram
59 : public QwtPlotSeriesItem
60 , public QwtSeriesStore< QwtIntervalSample >
61{
62 public:
70 {
78
85
90
96 UserStyle = 100
97 };
98
99 explicit QwtPlotHistogram( const QString& title = QString() );
100 explicit QwtPlotHistogram( const QwtText& title );
101 virtual ~QwtPlotHistogram();
102
103 virtual int rtti() const QWT_OVERRIDE;
104
105 void setPen( const QColor&,
106 qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
107
108 void setPen( const QPen& );
109 const QPen& pen() const;
110
111 void setBrush( const QBrush& );
112 const QBrush& brush() const;
113
114 void setSamples( const QVector< QwtIntervalSample >& );
115 void setSamples( QwtSeriesData< QwtIntervalSample >* );
116
117 void setBaseline( double );
118 double baseline() const;
119
120 void setStyle( HistogramStyle style );
121 HistogramStyle style() const;
122
123 void setSymbol( const QwtColumnSymbol* );
124 const QwtColumnSymbol* symbol() const;
125
126 virtual void drawSeries( QPainter*,
127 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
128 const QRectF& canvasRect, int from, int to ) const QWT_OVERRIDE;
129
130 virtual QRectF boundingRect() const QWT_OVERRIDE;
131
132 virtual QwtGraphic legendIcon(
133 int index, const QSizeF& ) const QWT_OVERRIDE;
134
135 protected:
136 virtual QwtColumnRect columnRect( const QwtIntervalSample&,
137 const QwtScaleMap&, const QwtScaleMap& ) const;
138
139 virtual void drawColumn( QPainter*, const QwtColumnRect&,
140 const QwtIntervalSample& ) const;
141
142 void drawColumns( QPainter*,
143 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
144 int from, int to ) const;
145
146 void drawOutline( QPainter*,
147 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
148 int from, int to ) const;
149
150 void drawLines( QPainter*,
151 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
152 int from, int to ) const;
153
154 private:
155 void init();
156 void flushPolygon( QPainter*, double baseLine, QPolygonF& ) const;
157
158 class PrivateData;
159 PrivateData* m_data;
160};
161
162#endif
Definition qwt_clipper.h:40
Directed rectangle representing bounding rectangle and orientation of a column.
Definition qwt_column_symbol.h:44
A drawing primitive for columns.
Definition qwt_column_symbol.h:91
A paint device for scalable graphics.
Definition qwt_graphic.h:93
A sample of the types (x1-x2, y) or (x, y1-y2)
Definition qwt_samples.h:38
QwtPlotHistogram represents a series of samples, where an interval is associated with a value ( ).
Definition qwt_plot_histogram.h:61
HistogramStyle
Histogram styles.
Definition qwt_plot_histogram.h:70
@ Lines
Draw a simple line using the pen() for each interval.
Definition qwt_plot_histogram.h:89
@ Columns
Draw a column for each interval.
Definition qwt_plot_histogram.h:84
@ Outline
Draw an outline around the area, that is build by all intervals using the pen() and fill it with the ...
Definition qwt_plot_histogram.h:77
virtual int rtti() const
Return rtti for the specific class represented.
Definition qwt_plot_item.cpp:153
Base class for plot items representing a series of samples.
Definition qwt_plot_seriesitem.h:43
A scale map.
Definition qwt_scale_map.h:44
Abstract interface for iterating over samples.
Definition qwt_series_data.h:67
Class storing a QwtSeriesData object.
Definition qwt_series_store.h:96
A class representing a text.
Definition qwt_text.h:69