1
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
3
* Copyright (C) 1997 Josef Wilgen
4
* Copyright (C) 2002 Uwe Rathmann
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
*****************************************************************************/
10
#ifndef QWT_PLOT_HISTOGRAM_H
11
#define QWT_PLOT_HISTOGRAM_H
13
#include "qwt_global.h"
14
#include "qwt_plot_seriesitem.h"
15
#include "qwt_column_symbol.h"
19
class QwtIntervalData;
24
\brief QwtPlotHistogram represents a series of samples, where an interval
25
is associated with a value ( \f$y = f([x1,x2])\f$ ).
27
The representation depends on the style() and an optional symbol()
28
that is displayed for each interval.
30
\note The term "histogram" is used in a different way in the areas of
31
digital image processing and statistics. Wikipedia introduces the
32
terms "image histogram" and "color histogram" to avoid confusions.
33
While "image histograms" can be displayed by a QwtPlotCurve there
34
is no applicable plot item for a "color histogram" yet.
37
class QWT_EXPORT QwtPlotHistogram: public QwtPlotSeriesItem<QwtIntervalSample>
42
The default style is QwtPlotHistogram::Columns.
44
\sa setStyle(), style(), setSymbol(), symbol(), setBaseline()
49
Draw an outline around the area, that is build by all intervals
50
using the pen() and fill it with the brush(). The outline style
51
requires, that the intervals are in increasing order and
57
Draw a column for each interval. When a symbol() has been set
58
the symbol is used otherwise the column is displayed as
59
plain rectangle using pen() and brush().
64
Draw a simple line using the pen() for each interval.
69
Styles >= UserStyle are reserved for derived
70
classes that overload drawSeries() with
71
additional application specific ways to display a histogram.
76
explicit QwtPlotHistogram( const QString &title = QString::null );
77
explicit QwtPlotHistogram( const QwtText &title );
78
virtual ~QwtPlotHistogram();
80
virtual int rtti() const;
82
void setPen( const QPen & );
83
const QPen &pen() const;
85
void setBrush( const QBrush & );
86
const QBrush &brush() const;
88
void setSamples( const QVector<QwtIntervalSample> & );
90
void setBaseline( double reference );
91
double baseline() const;
93
void setStyle( HistogramStyle style );
94
HistogramStyle style() const;
96
void setSymbol( const QwtColumnSymbol * );
97
const QwtColumnSymbol *symbol() const;
99
virtual void drawSeries( QPainter *p,
100
const QwtScaleMap &xMap, const QwtScaleMap &yMap,
101
const QRectF &canvasRect, int from, int to ) const;
103
virtual QRectF boundingRect() const;
105
virtual void drawLegendIdentifier( QPainter *, const QRectF & ) const;
108
virtual QwtColumnRect columnRect( const QwtIntervalSample &,
109
const QwtScaleMap &, const QwtScaleMap & ) const;
111
virtual void drawColumn( QPainter *, const QwtColumnRect &,
112
const QwtIntervalSample & ) const;
114
void drawColumns( QPainter *,
115
const QwtScaleMap &xMap, const QwtScaleMap &yMap,
116
int from, int to ) const;
118
void drawOutline( QPainter *,
119
const QwtScaleMap &xMap, const QwtScaleMap &yMap,
120
int from, int to ) const;
122
void drawLines( QPainter *,
123
const QwtScaleMap &xMap, const QwtScaleMap &yMap,
124
int from, int to ) const;
128
void flushPolygon( QPainter *, double baseLine, QPolygonF & ) const;