QwtPlotHistogram(3)
π QwtPlotHistogram(3) β Library Functions Manual π
okay so bestie, we're in section 3 of the manual (the Library Functions Manual, iykyk) and today's main character is <pink>QwtPlotHistogram</pink>. She's a plot item, she's got range, and she's about to make your intervals look iconic. Let's get into it β¨
π NAME
QwtPlotHistogram β QwtPlotHistogram represents a series of samples, where an interval is associated with a value ( $y = f([x1,x2])$ ).
πΈ SYNOPSIS
#include <qwt_plot_histogram.h>
Inherits QwtPlotSeriesItem, and QwtSeriesStore< QwtIntervalSample >.
β¨ Public Types β¨
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, fr fr enum ItemAttribute { Legend = 0x01, AutoScale = 0x02, Margins = 0x04 }β plot Item Attributesenum ItemInterest { ScaleInterest = 0x01, LegendInterest = 0x02 }β plot Item Interestsenum RenderHint { RenderAntialiased = 0x1 }β render hintstypedef QFlags< ItemAttribute > ItemAttributestypedef QFlags< ItemInterest > ItemIntereststypedef QFlags< RenderHint > RenderHints
π Public Member Functions π
QwtPlotHistogram (const QString &title=QString())QwtPlotHistogram (const QwtText &title)virtual ~QwtPlotHistogram ()β Destructorvirtual int rtti () const overridevoid setPen (const QColor &, qreal width=0.0, Qt::PenStyle=Qt::SolidLine)void setPen (const QPen &)const QPen & pen () constvoid setBrush (const QBrush &)const QBrush & brush () constvoid setSamples (const QVector< QwtIntervalSample > &)void setSamples (QwtSeriesData< QwtIntervalSample > *)void setBaseline (double)β set the value of the baselinedouble baseline () constvoid setStyle (HistogramStyle style)HistogramStyle style () constvoid setSymbol (const QwtColumnSymbol *)β assign a symbolconst QwtColumnSymbol * symbol () constvirtual void drawSeries (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const overridevirtual QRectF boundingRect () const overridevirtual 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 ()β Destructorvoid setOrientation (Qt::Orientation)Qt::Orientation orientation () constvirtual void draw (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const overrideβ draws the complete seriesvirtual void updateScaleDiv (const QwtScaleDiv &, const QwtScaleDiv &) overrideβ updates 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 theQwtPlotItemvoid attach (QwtPlot *plot)β attach the item to a plotvoid detach ()β this method detaches aQwtPlotItemfrom anyQwtPlotit has been associated withQwtPlot * plot () constβ return attached plotvoid setTitle (const QString &title)void setTitle (const QwtText &title)const QwtText & title () constvoid setItemAttribute (ItemAttribute, bool on=true)bool testItemAttribute (ItemAttribute) constvoid setItemInterest (ItemInterest, bool on=true)bool testItemInterest (ItemInterest) constvoid setRenderHint (RenderHint, bool on=true)bool testRenderHint (RenderHint) constvoid setRenderThreadCount (uint numThreads)uint renderThreadCount () constvoid setLegendIconSize (const QSize &)QSize legendIconSize () constdouble z () constvoid setZ (double z)β set the z valuevoid show ()β show the itemvoid hide ()β hide the itemvirtual void setVisible (bool)bool isVisible () constvoid setAxes (QwtAxisId xAxis, QwtAxisId yAxis)void setXAxis (QwtAxisId)QwtAxisId xAxis () constβ return xAxisvoid setYAxis (QwtAxisId)QwtAxisId yAxis () constβ return yAxisvirtual 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 marginvirtual void updateLegend (const QwtPlotItem *, const QList< QwtLegendData > &)β update the item to changes of the legend infoQRectF scaleRect (const QwtScaleMap &, const QwtScaleMap &) constβ calculate the bounding scale rectangle of 2 mapsQRectF paintRect (const QwtScaleMap &, const QwtScaleMap &) constβ calculate the bounding paint rectangle of 2 mapsvirtual 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 ()β Destructorvoid setData (QwtSeriesData< QwtIntervalSample > *series)QwtSeriesData< QwtIntervalSample > * data ()QwtIntervalSample sample (int index) constvirtual size_t dataSize () const overridevirtual QRectF dataRect () const overridevirtual void setRectOfInterest (const QRectF &rect) overrideQwtSeriesData< QwtIntervalSample > * swapData (QwtSeriesData< QwtIntervalSample > *series)
π Protected Member Functions π
virtual QwtColumnRect columnRect (const QwtIntervalSample &, const QwtScaleMap &, const QwtScaleMap &) constvirtual void drawColumn (QPainter *, const QwtColumnRect &, const QwtIntervalSample &) constvoid drawColumns (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) constvoid drawOutline (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) constvoid 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
π Detailed Description π
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. π not yet bestie.
See also: QwtPlotBarChart, QwtPlotMultiBarChart
Definition at line 41 of file qwt_plot_histogram.h.
π Member Enumeration Documentation π
enum QwtPlotHistogram::HistogramStyle
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 thepen()and fill it with thebrush(). The outline style requires, that the intervals are in increasing order and not overlapping. π yes that part matters, don't skip itColumnsβ draw a column for each interval. When asymbol()has been set the symbol is used otherwise the column is displayed as plain rectangle usingpen()andbrush().Linesβ draw a simple line using thepen()for each interval.UserStyleβ styles >=UserStyleare reserved for derived classes that overloaddrawSeries()with additional application specific ways to display a histogram.
Definition at line 52 of file qwt_plot_histogram.h.
π¦ Constructor & Destructor Documentation π¦
QwtPlotHistogram::QwtPlotHistogram (const QString & title = QString())
[explicit]
Constructor π«Ά
Parameters
titleβ title of the histogram.
Definition at line 74 of file qwt_plot_histogram.cpp.
QwtPlotHistogram::QwtPlotHistogram (const QwtText & title)
[explicit]
Constructor π«Ά
Parameters
titleβ title of the histogram.
Definition at line 64 of file qwt_plot_histogram.cpp.
QwtPlotHistogram::~QwtPlotHistogram ()
[virtual]
Destructor. she's done, she's logging off πβ¨
Definition at line 81 of file qwt_plot_histogram.cpp.
(part 1 done β but don't go anywhere, bestie, more is coming π)
π Member Function Documentation π
okay bestie, weβre in the member-function era now, and itβs lowkey a whole tour of QwtPlotHistogramβs moving parts. grab a strawberry drink π and letβs go function by function, no cap.
πΈ double QwtPlotHistogram::baseline () const
This one just hands you the baseline value, periodt.
- Returns: Value of the baseline
- See also:
setBaseline()
Definition at line 253 of file qwt_plot_histogram.cpp.
π¦ QRectF QwtPlotHistogram::boundingRect () const [override], [virtual]
Gives you the bounding rectangle of all samples. And listen: for an empty series the rectangle is invalid β not me making that up, thatβs the vibe check.
- 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.
π const QBrush & QwtPlotHistogram::brush () const
Returns the brush that gets used in a style() depending way. cute, contextual, iconic.
- Returns: Brush used in a
style()depending way. - See also:
setPen(),brush()
Definition at line 189 of file qwt_plot_histogram.cpp.
β¨ QwtColumnRect QwtPlotHistogram::columnRect (const QwtIntervalSample & sample, const QwtScaleMap & xMap, const QwtScaleMap & yMap) const [protected], [virtual]
Calculates the area that is covered by a sample. itβs giving geometry main character energy.
- Parameters:
sampleβ SamplexMapβ 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.
π
void QwtPlotHistogram::drawColumn (QPainter * painter, const QwtColumnRect & rect, const QwtIntervalSample & sample) const [protected], [virtual]
Draws a column for a sample in Columns style().
When a symbol() has been set the symbol is used; otherwise the column is displayed as a plain rectangle using pen() and brush(). slay, but make it rectangle.
- Parameters:
painterβ Painterrectβ Rectangle where to paint the column in paint device coordinatessampleβ 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.
π void QwtPlotHistogram::drawColumns (QPainter * painter, const QwtScaleMap & xMap, const QwtScaleMap & yMap, int from, int to) const [protected]
Draws a histogram in Columns style(). columns era, we love to see it.
- Parameters:
painterβ PainterxMapβ Maps x-values into pixel coordinates.yMapβ Maps y-values into pixel coordinates.fromβ Index of the first sample to be paintedtoβ Index of the last sample to be painted. Ifto < 0the histogram will be painted to its last point.
- See also:
setStyle(),style(),setSymbol(),drawColumn()
Definition at line 461 of file qwt_plot_histogram.cpp.
π§ void QwtPlotHistogram::drawLines (QPainter * painter, const QwtScaleMap & xMap, const QwtScaleMap & yMap, int from, int to) const [protected]
Draws a histogram in Lines style(). line girlies rise.
- Parameters:
painterβ PainterxMapβ Maps x-values into pixel coordinates.yMapβ Maps y-values into pixel coordinates.fromβ Index of the first sample to be paintedtoβ Index of the last sample to be painted. Ifto < 0the histogram will be painted to its last point.
- See also:
setStyle(),style(),setPen()
Definition at line 493 of file qwt_plot_histogram.cpp.
π«Ά void QwtPlotHistogram::drawOutline (QPainter * painter, const QwtScaleMap & xMap, const QwtScaleMap & yMap, int from, int to) const [protected]
Draws a histogram in Outline style(). very silhouette, very chic.
- Parameters:
painterβ PainterxMapβ Maps x-values into pixel coordinates.yMapβ Maps y-values into pixel coordinates.fromβ Index of the first sample to be paintedtoβ Index of the last sample to be painted. Ifto < 0the 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.
π₯ void QwtPlotHistogram::drawSeries (QPainter * painter, const QwtScaleMap & xMap, const QwtScaleMap & yMap, const QRectF & canvasRect, int from, int to) const [override], [virtual]
Draws a subset of the histogram samples. itβs the main draw call, literally.
- Parameters:
painterβ PainterxMapβ Maps x-values into pixel coordinates.yMapβ Maps y-values into pixel coordinates.canvasRectβ Contents rectangle of the canvasfromβ Index of the first sample to be paintedtoβ Index of the last sample to be painted. Ifto < 0the 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.
π QwtGraphic QwtPlotHistogram::legendIcon (int index, const QSizeF & size) const [override], [virtual]
A plain rectangle without pen using the brush(). legend icon, but make it minimal.
- 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.
π const QPen & QwtPlotHistogram::pen () const
Returns the pen that gets used in a style() depending way. yes bestie, pen and brush are a duo.
- Returns: Pen used in a
style()depending way. - See also:
setPen(),brush()
Definition at line 163 of file qwt_plot_histogram.cpp.
β int QwtPlotHistogram::rtti () const [override], [virtual]
Returns QwtPlotItem::Rtti_PlotHistogram. thatβs the identity check, iykyk.
- Returns:
QwtPlotItem::Rtti_PlotHistogram
Reimplemented from QwtPlotItem.
Definition at line 290 of file qwt_plot_histogram.cpp.
πΈ void QwtPlotHistogram::setBaseline (double value)
Sets 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. thatβs the whole column lore.
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.
π¦ void QwtPlotHistogram::setBrush (const QBrush & brush)
Assigns 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.
π void QwtPlotHistogram::setPen (const QColor & color, qreal width = 0.0, Qt::PenStyle style = Qt::SolidLine)
Builds and assigns a pen. itβs giving convenience with a side of Qt compatibility tea.
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 colorwidthβ Pen widthstyleβ Pen style
- See also:
pen(),brush()
Definition at line 137 of file qwt_plot_histogram.cpp.
β¨ void QwtPlotHistogram::setPen (const QPen & pen)
Assigns 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.
π void QwtPlotHistogram::setSamples (const QVector< QwtIntervalSample > & samples)
Initializes data with an array of samples. sample drop, but make it histograms.
- Parameters:
samplesβ Vector of points
Definition at line 299 of file qwt_plot_histogram.cpp.
π void QwtPlotHistogram::setSamples (QwtSeriesData< QwtIntervalSample > * data)
Assigns 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. honestly? relatable.
- 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.
π
void QwtPlotHistogram::setStyle (HistogramStyle style)
Sets the histogramβs drawing style. pick your aesthetic, bestie.
- Parameters:
styleβ Histogram style - See also:
HistogramStyle,style()
Definition at line 104 of file qwt_plot_histogram.cpp.
π§ void QwtPlotHistogram::setSymbol (const QwtColumnSymbol * symbol)
Assigns 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(). very choose-your-own-column-adventure.
- 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.
π«Ά QwtPlotHistogram::HistogramStyle QwtPlotHistogram::style () const
Returns the style of the histogram. vibe check: what aesthetic are we in?
- Returns: Style of the histogram
- See also:
HistogramStyle,setStyle()
Definition at line 119 of file qwt_plot_histogram.cpp.
π₯ const QwtColumnSymbol * QwtPlotHistogram::symbol () const
Returns the current symbol or NULL, when no symbol has been assigned. no symbol? no problem.
- Returns: Current symbol or
NULL, when no symbol has been assigned - See also:
setSymbol()
Definition at line 224 of file qwt_plot_histogram.cpp.
π§ Author π§
Generated automatically by Doxygen for Qwt User's Guide from the source code. no cap, thatβs the official source-code tea.
and thatβs the whole member-function saga, bestie π
β¨ β footer source/version vibe: Qwt User's Guide, page tag: QwtPlotHistogram(3), and the date is whatever your buildβs footer stamped on it. ππ¦
π¦ where this page comes from
- alpine 3.24: qwt-doc 6.3.0-r0 Β· custom
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms