QwtPlotHistogram − QwtPlotHistogram represents a series of samples, where an interval is associated with a value ( $y = f([x1,x2])$ ).
#include <qwt_plot_histogram.h>
Inherits QwtPlotSeriesItem, and QwtSeriesStore< QwtIntervalSample >.
enum HistogramStyle { Outline, Columns, Lines, UserStyle = 100 }
Public Types inherited from QwtPlotItem
enum RttiValues {
Rtti_PlotItem = 0, Rtti_PlotGrid,
Rtti_PlotScale, Rtti_PlotLegend,
Rtti_PlotMarker, Rtti_PlotCurve,
Rtti_PlotSpectroCurve, Rtti_PlotIntervalCurve,
Rtti_PlotHistogram, Rtti_PlotSpectrogram,
Rtti_PlotGraphic, Rtti_PlotTradingCurve,
Rtti_PlotBarChart, Rtti_PlotMultiBarChart,
Rtti_PlotShape, Rtti_PlotTextLabel,
Rtti_PlotZone, Rtti_PlotVectorField,
Rtti_PlotUserItem = 1000 }
Runtime type information.
enum ItemAttribute { Legend = 0x01,
AutoScale = 0x02, Margins = 0x04 }
Plot Item Attributes.
enum ItemInterest { ScaleInterest = 0x01,
LegendInterest = 0x02 }
Plot Item Interests.
enum RenderHint { RenderAntialiased = 0x1 }
Render hints.
typedef QFlags< ItemAttribute >
ItemAttributes
typedef QFlags< ItemInterest >
ItemInterests
typedef QFlags< RenderHint >
RenderHints
QwtPlotHistogram
(const QString &title=QString())
QwtPlotHistogram (const QwtText
&title)
virtual ˜QwtPlotHistogram ()
Destructor.
virtual int rtti () const override
void setPen (const QColor &, qreal width=0.0,
Qt::PenStyle=Qt::SolidLine)
void setPen (const QPen &)
const QPen & pen () const
void setBrush (const QBrush &)
const QBrush & brush () const
void setSamples (const QVector<
QwtIntervalSample > &)
void setSamples (QwtSeriesData<
QwtIntervalSample > *)
void setBaseline (double)
Set the value of the baseline.
double baseline () const
void setStyle (HistogramStyle style)
HistogramStyle style () const
void setSymbol (const QwtColumnSymbol *)
Assign a symbol.
const QwtColumnSymbol * symbol () const
virtual void drawSeries (QPainter *, const
QwtScaleMap &xMap, const QwtScaleMap
&yMap, const QRectF &canvasRect, int from, int to)
const override
virtual QRectF boundingRect () const override
virtual QwtGraphic legendIcon (int index, const
QSizeF &) const override
Public Member Functions inherited from QwtPlotSeriesItem
QwtPlotSeriesItem (const
QString &title=QString())
QwtPlotSeriesItem (const QwtText
&title)
virtual ˜QwtPlotSeriesItem ()
Destructor.
void setOrientation (Qt::Orientation)
Qt::Orientation orientation () const
virtual void draw (QPainter *, const
QwtScaleMap &xMap, const QwtScaleMap
&yMap, const QRectF &canvasRect) const override
Draw the complete series.
virtual void updateScaleDiv (const QwtScaleDiv
&, const QwtScaleDiv &) override
Update the item to changes of the axes scale division.
Public Member Functions inherited from QwtPlotItem
QwtPlotItem ()
QwtPlotItem (const QString &title)
QwtPlotItem (const QwtText &title)
virtual ˜QwtPlotItem ()
Destroy the QwtPlotItem.
void attach (QwtPlot *plot)
Attach the item to a plot.
void detach ()
This method detaches a QwtPlotItem from any
QwtPlot it has been associated with.
QwtPlot * plot () const
Return attached plot.
void setTitle (const QString &title)
void setTitle (const QwtText
&title)
const QwtText & title () const
void setItemAttribute (ItemAttribute, bool
on=true)
bool testItemAttribute (ItemAttribute) const
void setItemInterest (ItemInterest, bool
on=true)
bool testItemInterest (ItemInterest) const
void setRenderHint (RenderHint, bool on=true)
bool testRenderHint (RenderHint) const
void setRenderThreadCount (uint numThreads)
uint renderThreadCount () const
void setLegendIconSize (const QSize &)
QSize legendIconSize () const
double z () const
void setZ (double z)
Set the z value.
void show ()
Show the item.
void hide ()
Hide the item.
virtual void setVisible (bool)
bool isVisible () const
void setAxes (QwtAxisId xAxis, QwtAxisId
yAxis)
void setXAxis (QwtAxisId)
QwtAxisId xAxis () const
Return xAxis.
void setYAxis (QwtAxisId)
QwtAxisId yAxis () const
Return yAxis.
virtual void itemChanged ()
virtual void legendChanged ()
virtual void getCanvasMarginHint (const
QwtScaleMap &xMap, const QwtScaleMap
&yMap, const QRectF &canvasRect, double &left,
double &top, double &right, double &bottom)
const
Calculate a hint for the canvas margin.
virtual void updateLegend (const QwtPlotItem
*, const QList< QwtLegendData > &)
Update the item to changes of the legend info.
QRectF scaleRect (const QwtScaleMap &,
const QwtScaleMap &) const
Calculate the bounding scale rectangle of 2 maps.
QRectF paintRect (const QwtScaleMap &,
const QwtScaleMap &) const
Calculate the bounding paint rectangle of 2 maps.
virtual QList< QwtLegendData >
legendData () const
Return all information, that is needed to represent the item
on the legend.
Public Member Functions inherited from QwtAbstractSeriesStore
virtual
˜QwtAbstractSeriesStore ()
Destructor.
Public Member Functions inherited from QwtSeriesStore< QwtIntervalSample >
QwtSeriesStore ()
Constructor The store contains no series.
˜QwtSeriesStore ()
Destructor.
void setData (QwtSeriesData<
QwtIntervalSample > *series)
QwtSeriesData< QwtIntervalSample > *
data ()
const QwtSeriesData< QwtIntervalSample >
* data () const
QwtIntervalSample sample (int index) const
virtual size_t dataSize () const override
virtual QRectF dataRect () const override
virtual void setRectOfInterest (const QRectF
&rect) override
QwtSeriesData< QwtIntervalSample > *
swapData (QwtSeriesData<
QwtIntervalSample > *series)
virtual
QwtColumnRect columnRect (const
QwtIntervalSample &, const QwtScaleMap
&, const QwtScaleMap &) const
virtual void drawColumn (QPainter *, const
QwtColumnRect &, const QwtIntervalSample
&) const
void drawColumns (QPainter *, const
QwtScaleMap &xMap, const QwtScaleMap
&yMap, int from, int to) const
void drawOutline (QPainter *, const
QwtScaleMap &xMap, const QwtScaleMap
&yMap, int from, int to) const
void drawLines (QPainter *, const QwtScaleMap
&xMap, const QwtScaleMap &yMap, int from, int
to) const
Protected Member Functions inherited from QwtPlotSeriesItem
virtual void dataChanged
() override
dataChanged() indicates, that the series has been
changed.
Protected Member Functions inherited from QwtPlotItem
QwtGraphic defaultIcon
(const QBrush &, const QSizeF &) const
Return a default icon from a brush.
QwtPlotHistogram represents a series of samples, where an interval is associated with a value ( $y = f([x1,x2])$ ).
The representation depends on the style() and an optional symbol() that is displayed for each interval.
Note
The term "histogram" is used in a different way in the areas of digital image processing and statistics. Wikipedia introduces the terms "image histogram" and "color histogram" to avoid confusions. While "image histograms" can be displayed by a QwtPlotCurve there is no applicable plot item for a "color histogram" yet.
See also
QwtPlotBarChart, QwtPlotMultiBarChart
Definition at line 41 of file qwt_plot_histogram.h.
Histogram styles. The default style is QwtPlotHistogram::Columns.
See also
setStyle(), style(), setSymbol(), symbol(), setBaseline()
Enumerator
Outline
Draw an outline around the area, that is build by all intervals using the pen() and fill it with the brush(). The outline style requires, that the intervals are in increasing order and not overlapping.
Columns
Draw a column for each interval. When a symbol() has been set the symbol is used otherwise the column is displayed as plain rectangle using pen() and brush().
|
Lines |
Draw a simple line using the pen() for each interval. |
UserStyle
Styles >= UserStyle are reserved for derived classes that overload drawSeries() with additional application specific ways to display a histogram.
Definition at line 52 of file qwt_plot_histogram.h.
Constructor
Parameters
title Title of the histogram.
Definition at line 74 of file qwt_plot_histogram.cpp.
Constructor
Parameters
title Title of the histogram.
Definition at line 64 of file qwt_plot_histogram.cpp.
Destructor.
Definition at line 81 of file qwt_plot_histogram.cpp.
Returns
Value of the baseline
See also
setBaseline()
Definition at line 253 of file qwt_plot_histogram.cpp.
Returns
Bounding rectangle of all samples. For an empty series the rectangle is invalid.
Reimplemented from QwtPlotSeriesItem.
Definition at line 262 of file qwt_plot_histogram.cpp.
Returns
Brush used in a style() depending way.
See also
setPen(), brush()
Definition at line 189 of file qwt_plot_histogram.cpp.
Calculate the area that is covered by a sample
Parameters
sample Sample
xMap Maps x-values into pixel coordinates.
yMap Maps y-values into pixel coordinates.
Returns
Rectangle, that is covered by a sample
Definition at line 602 of file qwt_plot_histogram.cpp.
Draw a column for a sample in Columns style().
When a symbol() has been set the symbol is used otherwise the column is displayed as plain rectangle using pen() and brush().
Parameters
painter Painter
rect Rectangle where to paint the column in paint device
coordinates
sample Sample to be displayed
Note
In applications, where different intervals need to be displayed in a different way ( f.e different colors or even using different symbols) it is recommended to overload drawColumn().
Definition at line 653 of file qwt_plot_histogram.cpp.
Draw a histogram in Columns style()
Parameters
painter Painter
xMap Maps x-values into pixel coordinates.
yMap Maps y-values into pixel coordinates.
from Index of the first sample to be painted
to Index of the last sample to be painted. If to < 0
the histogram will be painted to its last point.
See also
setStyle(), style(), setSymbol(), drawColumn()
Definition at line 461 of file qwt_plot_histogram.cpp.
Draw a histogram in Lines style()
Parameters
painter Painter
xMap Maps x-values into pixel coordinates.
yMap Maps y-values into pixel coordinates.
from Index of the first sample to be painted
to Index of the last sample to be painted. If to < 0
the histogram will be painted to its last point.
See also
setStyle(), style(), setPen()
Definition at line 493 of file qwt_plot_histogram.cpp.
Draw a histogram in Outline style()
Parameters
painter Painter
xMap Maps x-values into pixel coordinates.
yMap Maps y-values into pixel coordinates.
from Index of the first sample to be painted
to Index of the last sample to be painted. If to < 0
the histogram will be painted to its last point.
See also
setStyle(), style()
Warning
The outline style requires, that the intervals are in increasing order and not overlapping.
Definition at line 376 of file qwt_plot_histogram.cpp.
Draw a subset of the histogram samples
Parameters
painter Painter
xMap Maps x-values into pixel coordinates.
yMap Maps y-values into pixel coordinates.
canvasRect Contents rectangle of the canvas
from Index of the first sample to be painted
to Index of the last sample to be painted. If to < 0
the series will be painted to its last sample.
See also
drawOutline(), drawLines(), drawColumns
Implements QwtPlotSeriesItem.
Definition at line 334 of file qwt_plot_histogram.cpp.
A plain rectangle without pen using the brush()
Parameters
index Index of the
legend entry ( ignored as there is only one )
size Icon size
Returns
A graphic displaying the icon
See also
QwtPlotItem::setLegendIconSize(), QwtPlotItem::legendData()
Reimplemented from QwtPlotItem.
Definition at line 688 of file qwt_plot_histogram.cpp.
Returns
Pen used in a style() depending way.
See also
setPen(), brush()
Definition at line 163 of file qwt_plot_histogram.cpp.
Returns
QwtPlotItem::Rtti_PlotHistogram
Reimplemented from QwtPlotItem.
Definition at line 290 of file qwt_plot_histogram.cpp.
Set the value of the baseline. Each column representing an QwtIntervalSample is defined by its interval and the interval between baseline and the value of the sample.
The default value of the baseline is 0.0.
Parameters
value Value of the baseline
See also
baseline()
Definition at line 240 of file qwt_plot_histogram.cpp.
Assign a brush, that is used in a style() depending way.
Parameters
brush New brush
See also
pen(), brush()
Definition at line 174 of file qwt_plot_histogram.cpp.
Build and assign a pen
In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it non cosmetic ( see QPen::isCosmetic() ). This method has been introduced to hide this incompatibility.
Parameters
color Pen color
width Pen width
style Pen style
See also
pen(), brush()
Definition at line 137 of file qwt_plot_histogram.cpp.
Assign a pen, that is used in a style() depending way.
Parameters
pen New pen
See also
pen(), brush()
Definition at line 148 of file qwt_plot_histogram.cpp.
Initialize data with an array of samples.
Parameters
samples Vector of points
Definition at line 299 of file qwt_plot_histogram.cpp.
Assign a series of samples
setSamples() is just a wrapper for setData() without any additional value - beside that it is easier to find for the developer.
Parameters
data Data
Warning
The item takes ownership of the data object, deleting it when its not used anymore.
Definition at line 315 of file qwt_plot_histogram.cpp.
Set the histogram’s drawing style
Parameters
style Histogram style
See also
HistogramStyle, style()
Definition at line 104 of file qwt_plot_histogram.cpp.
Assign a symbol. In Column style an optional symbol can be assigned, that is responsible for displaying the rectangle that is defined by the interval and the distance between baseline() and value. When no symbol has been defined the area is displayed as plain rectangle using pen() and brush().
See also
style(), symbol(), drawColumn(), pen(), brush()
Note
In applications, where different intervals need to be displayed in a different way ( f.e different colors or even using different symbols) it is recommended to overload drawColumn().
Definition at line 208 of file qwt_plot_histogram.cpp.
Returns
Style of the histogram
See also
HistogramStyle, setStyle()
Definition at line 119 of file qwt_plot_histogram.cpp.
Returns
Current symbol or NULL, when no symbol has been assigned
See also
setSymbol()
Definition at line 224 of file qwt_plot_histogram.cpp.
Generated automatically by Doxygen for Qwt User’s Guide from the source code.