QwtPlotHistogram represents a series of samples, where an interval is associated with a value ( ). More...
#include <qwt_plot_histogram.h>
Classes | |
class | PrivateData |
Public Types | |
enum | HistogramStyle { Outline, Columns, Lines, UserStyle = 100 } |
Public Types inherited from QwtPlotItem | |
enum | ItemAttribute { Legend = 0x01, AutoScale = 0x02, Margins = 0x04 } |
Plot Item Attributes. More... | |
typedef QFlags< ItemAttribute > | ItemAttributes |
Plot Item Attributes. More... | |
enum | ItemInterest { ScaleInterest = 0x01, LegendInterest = 0x02 } |
Plot Item Interests. More... | |
typedef QFlags< ItemInterest > | ItemInterests |
Plot Item Interests. More... | |
enum | RenderHint { RenderAntialiased = 0x1 } |
Render hints. More... | |
typedef QFlags< RenderHint > | RenderHints |
Render hints. More... | |
enum | RttiValues { Rtti_PlotItem = 0, Rtti_PlotGrid, Rtti_PlotScale, Rtti_PlotLegend, Rtti_PlotMarker, Rtti_PlotCurve, Rtti_PlotSpectroCurve, Rtti_PlotIntervalCurve, Rtti_PlotHistogram, Rtti_PlotSpectrogram, Rtti_PlotSVG, Rtti_PlotTradingCurve, Rtti_PlotBarChart, Rtti_PlotMultiBarChart, Rtti_PlotShape, Rtti_PlotTextLabel, Rtti_PlotZone, Rtti_PlotUserItem = 1000 } |
Runtime type information. More... | |
Public Member Functions | |
double | baseline () const |
virtual QRectF | boundingRect () const |
const QBrush & | brush () const |
virtual void | drawSeries (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const |
virtual QwtGraphic | legendIcon (int index, const QSizeF &) const |
const QPen & | pen () const |
QwtPlotHistogram (const QString &title=QString()) | |
QwtPlotHistogram (const QwtText &title) | |
virtual int | rtti () const |
void | setBaseline (double reference) |
Set the value of the baseline. More... | |
void | setBrush (const QBrush &) |
void | setPen (const QColor &, qreal width=0.0, Qt::PenStyle=Qt::SolidLine) |
void | setPen (const QPen &) |
void | setSamples (const QVector< QwtIntervalSample > &) |
void | setSamples (QwtSeriesData< QwtIntervalSample > *) |
void | setStyle (HistogramStyle style) |
void | setSymbol (const QwtColumnSymbol *) |
Assign a symbol. More... | |
HistogramStyle | style () const |
const QwtColumnSymbol * | symbol () const |
virtual | ~QwtPlotHistogram () |
Destructor. More... | |
Public Member Functions inherited from QwtPlotSeriesItem | |
virtual void | draw (QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &) const |
Draw the complete series. More... | |
Qt::Orientation | orientation () const |
QwtPlotSeriesItem (const QString &title=QString()) | |
QwtPlotSeriesItem (const QwtText &title) | |
void | setOrientation (Qt::Orientation) |
virtual void | updateScaleDiv (const QwtScaleDiv &, const QwtScaleDiv &) |
Update the item to changes of the axes scale division. More... | |
virtual | ~QwtPlotSeriesItem () |
Destructor. More... | |
Public Member Functions inherited from QwtPlotItem | |
void | attach (QwtPlot *plot) |
Attach the item to a plot. More... | |
void | detach () |
This method detaches a QwtPlotItem from any QwtPlot it has been associated with. More... | |
virtual void | getCanvasMarginHint (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasSize, double &left, double &top, double &right, double &bottom) const |
Calculate a hint for the canvas margin. More... | |
void | hide () |
Hide the item. More... | |
bool | isVisible () const |
virtual void | itemChanged () |
virtual void | legendChanged () |
virtual QList< QwtLegendData > | legendData () const |
Return all information, that is needed to represent the item on the legend. More... | |
QSize | legendIconSize () const |
QRectF | paintRect (const QwtScaleMap &, const QwtScaleMap &) const |
Calculate the bounding paint rectangle of 2 maps. More... | |
QwtPlot * | plot () const |
Return attached plot. More... | |
QwtPlotItem (const QwtText &title=QwtText()) | |
uint | renderThreadCount () const |
QRectF | scaleRect (const QwtScaleMap &, const QwtScaleMap &) const |
Calculate the bounding scale rectangle of 2 maps. More... | |
void | setAxes (int xAxis, int yAxis) |
void | setItemAttribute (ItemAttribute, bool on=true) |
void | setItemInterest (ItemInterest, bool on=true) |
void | setLegendIconSize (const QSize &) |
void | setRenderHint (RenderHint, bool on=true) |
void | setRenderThreadCount (uint numThreads) |
void | setTitle (const QString &title) |
void | setTitle (const QwtText &title) |
virtual void | setVisible (bool) |
void | setXAxis (int axis) |
void | setYAxis (int axis) |
void | setZ (double z) |
Set the z value. More... | |
void | show () |
Show the item. More... | |
bool | testItemAttribute (ItemAttribute) const |
bool | testItemInterest (ItemInterest) const |
bool | testRenderHint (RenderHint) const |
const QwtText & | title () const |
virtual void | updateLegend (const QwtPlotItem *, const QList< QwtLegendData > &) |
Update the item to changes of the legend info. More... | |
int | xAxis () const |
Return xAxis. More... | |
int | yAxis () const |
Return yAxis. More... | |
double | z () const |
virtual | ~QwtPlotItem () |
Destroy the QwtPlotItem. More... | |
Public Member Functions inherited from QwtSeriesStore< QwtIntervalSample > | |
QwtSeriesData< QwtIntervalSample > * | data () |
const QwtSeriesData< QwtIntervalSample > * | data () const |
virtual QRectF | dataRect () const |
virtual size_t | dataSize () const |
QwtSeriesStore () | |
Constructor The store contains no series. More... | |
QwtIntervalSample | sample (int index) const |
void | setData (QwtSeriesData< QwtIntervalSample > *series) |
virtual void | setRectOfInterest (const QRectF &rect) |
QwtSeriesData< QwtIntervalSample > * | swapData (QwtSeriesData< QwtIntervalSample > *series) |
~QwtSeriesStore () | |
Destructor. More... | |
Protected Member Functions | |
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 | drawLines (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 |
Protected Member Functions inherited from QwtPlotSeriesItem | |
virtual void | dataChanged () |
dataChanged() indicates, that the series has been changed. More... | |
Protected Member Functions inherited from QwtPlotItem | |
QwtGraphic | defaultIcon (const QBrush &, const QSizeF &) const |
Return a default icon from a brush. More... | |
Protected Member Functions inherited from QwtAbstractSeriesStore | |
virtual | ~QwtAbstractSeriesStore () |
Destructor. More... | |
Private Member Functions | |
void | flushPolygon (QPainter *, double baseLine, QPolygonF &) const |
Internal, used by the Outline style. More... | |
void | init () |
Initialize data members. More... | |
Private Attributes | |
PrivateData * | d_data |
QwtPlotHistogram represents a series of samples, where an interval is associated with a value ( ).
The representation depends on the style() and an optional symbol() that is displayed for each interval.
Definition at line 39 of file qwt_plot_histogram.h.
Histogram styles. The default style is QwtPlotHistogram::Columns.
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 49 of file qwt_plot_histogram.h.
|
explicit |
Constructor
title | Title of the histogram. |
Definition at line 73 of file qwt_plot_histogram.cpp.
|
explicit |
Constructor
title | Title of the histogram. |
Definition at line 63 of file qwt_plot_histogram.cpp.
|
virtual |
Destructor.
Definition at line 80 of file qwt_plot_histogram.cpp.
double QwtPlotHistogram::baseline | ( | ) | const |
Definition at line 252 of file qwt_plot_histogram.cpp.
|
virtual |
Reimplemented from QwtPlotSeriesItem.
Definition at line 261 of file qwt_plot_histogram.cpp.
const QBrush & QwtPlotHistogram::brush | ( | ) | const |
Definition at line 188 of file qwt_plot_histogram.cpp.
|
protectedvirtual |
Calculate the area that is covered by a sample
sample | Sample |
xMap | Maps x-values into pixel coordinates. |
yMap | Maps y-values into pixel coordinates. |
Definition at line 599 of file qwt_plot_histogram.cpp.
|
protectedvirtual |
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().
painter | Painter |
rect | Rectangle where to paint the column in paint device coordinates |
sample | Sample to be displayed |
Definition at line 650 of file qwt_plot_histogram.cpp.
|
protected |
Draw a histogram in Columns style()
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. |
Definition at line 458 of file qwt_plot_histogram.cpp.
|
protected |
Draw a histogram in Lines style()
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. |
Definition at line 490 of file qwt_plot_histogram.cpp.
|
protected |
Draw a histogram in Outline style()
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. |
Definition at line 373 of file qwt_plot_histogram.cpp.
|
virtual |
Draw a subset of the histogram samples
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. |
Implements QwtPlotSeriesItem.
Definition at line 333 of file qwt_plot_histogram.cpp.
|
private |
Internal, used by the Outline style.
Definition at line 549 of file qwt_plot_histogram.cpp.
|
private |
Initialize data members.
Definition at line 86 of file qwt_plot_histogram.cpp.
|
virtual |
A plain rectangle without pen using the brush()
index | Index of the legend entry ( ignored as there is only one ) |
size | Icon size |
Reimplemented from QwtPlotItem.
Definition at line 685 of file qwt_plot_histogram.cpp.
const QPen & QwtPlotHistogram::pen | ( | ) | const |
Definition at line 162 of file qwt_plot_histogram.cpp.
|
virtual |
Reimplemented from QwtPlotItem.
Definition at line 289 of file qwt_plot_histogram.cpp.
void QwtPlotHistogram::setBaseline | ( | double | value | ) |
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.
value | Value of the baseline |
Definition at line 239 of file qwt_plot_histogram.cpp.
void QwtPlotHistogram::setBrush | ( | const QBrush & | brush | ) |
Assign a brush, that is used in a style() depending way.
brush | New brush |
Definition at line 173 of file qwt_plot_histogram.cpp.
void QwtPlotHistogram::setPen | ( | const QColor & | color, |
qreal | width = 0.0 , |
||
Qt::PenStyle | style = Qt::SolidLine |
||
) |
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.
color | Pen color |
width | Pen width |
style | Pen style |
Definition at line 136 of file qwt_plot_histogram.cpp.
void QwtPlotHistogram::setPen | ( | const QPen & | pen | ) |
Assign a pen, that is used in a style() depending way.
pen | New pen |
Definition at line 147 of file qwt_plot_histogram.cpp.
void QwtPlotHistogram::setSamples | ( | const QVector< QwtIntervalSample > & | samples | ) |
Initialize data with an array of samples.
samples | Vector of points |
Definition at line 298 of file qwt_plot_histogram.cpp.
void QwtPlotHistogram::setSamples | ( | QwtSeriesData< QwtIntervalSample > * | data | ) |
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.
data | Data |
Definition at line 314 of file qwt_plot_histogram.cpp.
void QwtPlotHistogram::setStyle | ( | HistogramStyle | style | ) |
Set the histogram's drawing style
style | Histogram style |
Definition at line 103 of file qwt_plot_histogram.cpp.
void QwtPlotHistogram::setSymbol | ( | const QwtColumnSymbol * | symbol | ) |
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().
Definition at line 207 of file qwt_plot_histogram.cpp.
QwtPlotHistogram::HistogramStyle QwtPlotHistogram::style | ( | ) | const |
Definition at line 118 of file qwt_plot_histogram.cpp.
const QwtColumnSymbol * QwtPlotHistogram::symbol | ( | ) | const |
Definition at line 223 of file qwt_plot_histogram.cpp.
|
private |
Definition at line 135 of file qwt_plot_histogram.h.