QwtPlotBarChart(3)

πŸ’– QwtPlotBarChart(3) β€” Library Functions Manual πŸ’–

🌸 NAME 🌸

QwtPlotBarChart β€” QwtPlotBarChart displays a series of a values as bars.

This is the manual page for QwtPlotBarChart(3), so the manual name is folded in right here, bestie.

πŸ¦‹ SYNOPSIS πŸ¦‹

#include <qwt_plot_barchart.h>

Inherits QwtPlotAbstractBarChart, and QwtSeriesStore< QPointF >.

πŸ’… Public Types πŸ’…

  • enum LegendMode { LegendChartTitle, LegendBarTitles } β€” Legend modes.

🧚 Public Types inherited from QwtPlotAbstractBarChart 🧚

  • enum LayoutPolicy { AutoAdjustSamples, ScaleSamplesToAxes, ScaleSampleToCanvas, FixedSampleSize } β€” Mode how to calculate the bar width.

🌈 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

πŸ‘‘ Public Member Functions πŸ‘‘

  • QwtPlotBarChart (const QString &title=QString())
  • QwtPlotBarChart (const QwtText &title)
  • virtual ~QwtPlotBarChart () β€” Destructor.
  • virtual int rtti () const override
  • void setSamples (const QVector< QPointF > &)
  • void setSamples (const QVector< double > &)
  • void setSamples (QwtSeriesData< QPointF > *)
  • void setSymbol (QwtColumnSymbol *) β€” Assign a symbol.
  • const QwtColumnSymbol * symbol () const
  • void setLegendMode (LegendMode)
  • LegendMode legendMode () 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 QwtColumnSymbol * specialSymbol (int sampleIndex, const QPointF &) const
  • virtual QwtText barTitle (int sampleIndex) const β€” Return the title of a bar.

πŸ¦‹ Public Member Functions inherited from QwtPlotAbstractBarChart πŸ¦‹

  • QwtPlotAbstractBarChart (const QwtText &title)
  • virtual ~QwtPlotAbstractBarChart () β€” Destructor.
  • void setLayoutPolicy (LayoutPolicy)
  • LayoutPolicy layoutPolicy () const
  • void setLayoutHint (double)
  • double layoutHint () const
  • void setSpacing (int) β€” Set the spacing.
  • int spacing () const
  • void setMargin (int) β€” Set the margin.
  • int margin () const
  • void setBaseline (double) β€” Set the baseline.
  • double baseline () const
  • virtual void getCanvasMarginHint (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, double &left, double &top, double &right, double &bottom) const override β€” Calculate a hint for the canvas margin.

🌸 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 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.

πŸŽ€ Public Member Functions inherited from QwtAbstractSeriesStore πŸŽ€

  • virtual ~QwtAbstractSeriesStore () β€” Destructor.

πŸ“ Public Member Functions inherited from QwtSeriesStore< QPointF > πŸ“

  • QwtSeriesStore () β€” Constructor The store contains no series.
  • ~QwtSeriesStore () β€” Destructor.
  • void setData (QwtSeriesData< QPointF > *series)
  • QwtSeriesData< QPointF > * data ()
  • QPointF sample (int index) const
  • virtual size_t dataSize () const override
  • virtual QRectF dataRect () const override
  • virtual void setRectOfInterest (const QRectF &rect) override
  • QwtSeriesData< QPointF > * swapData (QwtSeriesData< QPointF > *series)

🧚 Protected Member Functions 🧚

  • virtual void drawSample (QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, const QwtInterval &boundingInterval, int index, const QPointF &sample) const
  • virtual void drawBar (QPainter *, int sampleIndex, const QPointF &sample, const QwtColumnRect &) const
  • QwtColumnRect columnRect (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, const QwtInterval &boundingInterval, const QPointF &sample) const
  • QList< QwtLegendData > legendData () const override β€” Return all information, that is needed to represent the item on the legend.
  • QwtGraphic legendIcon (int index, const QSizeF &) const override

🌿 Protected Member Functions inherited from QwtPlotAbstractBarChart 🌿

  • double sampleWidth (const QwtScaleMap &map, double canvasSize, double boundingSize, double value) 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 🌈

QwtPlotBarChart displays a series of a values as bars. That's the whole assignment, bestie.

Each bar might be customized individually by implementing a specialSymbol(). Otherwise it is rendered using a default symbol.

Depending on its orientation() the bars are displayed horizontally or vertically. The bars cover the interval between the baseline() and the value.

By activating the LegendBarTitles mode each sample will have its own entry on the legend.

The most common use case of a bar chart is literally a list of y coordinates, where the x coordinate is simply the index in the list. But for other situations ( f.e. when values are related to dates ) it is also possible to set x coordinates explicitly.

See also: QwtPlotMultiBarChart, QwtPlotHistogram, QwtPlotCurve::Sticks, QwtPlotSeriesItem::orientation(), QwtPlotAbstractBarChart::baseline().

Source: Definition at line 41 of file qwt_plot_barchart.h.

πŸŽ€ Member Enumeration Documentation πŸŽ€

πŸ’… enum QwtPlotBarChart::LegendMode πŸ’…

Legend modes. The default setting is QwtPlotBarChart::LegendChartTitle.

See also: setLegendMode(), legendMode().

✨ Enumerator ✨

  • LegendChartTitle β€” One entry on the legend showing the default symbol and the title() of the chart. See also: QwtPlotItem::title().
  • LegendBarTitles β€” One entry for each value showing the individual symbol of the corresponding bar and the bar title. See also: specialSymbol(), barTitle().

Source: Definition at line 52 of file qwt_plot_barchart.h.

πŸ‘‘ Constructor & Destructor Documentation πŸ‘‘

πŸ¦‹ QwtPlotBarChart::QwtPlotBarChart (const QString & title = QString()) πŸ¦‹

[explicit] Constructor

Parameters: title β€” Title of the curve.

Source: Definition at line 51 of file qwt_plot_barchart.cpp.

🌸 QwtPlotBarChart::QwtPlotBarChart (const QwtText & title) 🌸

[explicit] Constructor

Parameters: title β€” Title of the curve.

Source: Definition at line 41 of file qwt_plot_barchart.cpp.

πŸ’œ QwtPlotBarChart::~QwtPlotBarChart () πŸ’œ

[virtual] Destructor.

Source: Definition at line 58 of file qwt_plot_barchart.cpp.

πŸ’… MEMBER FUNCTION DOCUMENTATION πŸ’…

okay bestie, this is the big one β€” every single member function, laid out one by one. no skipping, no "you get the idea". we're doing all of them. grab a snack πŸ“


πŸŽ€ barTitle πŸŽ€

QwtText QwtPlotBarChart::barTitle (int sampleIndex) const [virtual]

Returns the title of a bar. In LegendBarTitles mode that title is what shows up on the legend entry matching that bar.

The default implementation is literally just a dummy β€” it's intended to be overloaded by you, the main character. so if you want real titles, you're gonna have to do the work yourself πŸ’…

Parameters

  • sampleIndex β€” Index of the bar

Returns

An empty text

See also

LegendBarTitles

Definition at line 399 of file qwt_plot_barchart.cpp.

πŸ¦‹ boundingRect πŸ¦‹

QRectF QwtPlotBarChart::boundingRect () const [override], [virtual]

Returns

Bounding rectangle of all samples. For an empty series the rectangle is invalid β€” so like, no samples, no rectangle, that's just how it is 😭

Reimplemented from QwtPlotSeriesItem.

Definition at line 186 of file qwt_plot_barchart.cpp.

✨ columnRect ✨

QwtColumnRect QwtPlotBarChart::columnRect (const QwtScaleMap & xMap, const QwtScaleMap & yMap, const QRectF & canvasRect, const QwtInterval & boundingInterval, const QPointF & sample) const [protected]

Calculates the geometry of a bar in widget coordinates. this is the "where does the bar physically go" function, lowkey iconic.

Parameters

  • xMap β€” x map
  • yMap β€” y map
  • canvasRect β€” Contents rect of the canvas
  • boundingInterval β€” Bounding interval of sample values
  • sample β€” Value of the sample

Returns

Geometry of the column

Definition at line 262 of file qwt_plot_barchart.cpp.

🌸 drawBar 🌸

void QwtPlotBarChart::drawBar (QPainter * painter, int sampleIndex, const QPointF & sample, const QwtColumnRect & rect) const [protected], [virtual]

Draws a bar. one bar. that's the whole vibe.

Parameters

  • painter β€” Painter
  • sampleIndex β€” Index of the sample represented by the bar
  • sample β€” Value of the sample
  • rect β€” Bounding rectangle of the bar
Definition at line 341 of file qwt_plot_barchart.cpp.

🧚 drawSample 🧚

void QwtPlotBarChart::drawSample (QPainter * painter, const QwtScaleMap & xMap, const QwtScaleMap & yMap, const QRectF & canvasRect, const QwtInterval & boundingInterval, int index, const QPointF & sample) const [protected], [virtual]

Draws a sample. ✨

Parameters

  • painter β€” Painter
  • xMap β€” x map
  • yMap β€” y map
  • canvasRect β€” Contents rect of the canvas
  • boundingInterval β€” Bounding interval of sample values
  • index β€” Index of the sample
  • sample β€” Value of the sample

See also

drawSeries()

Definition at line 322 of file qwt_plot_barchart.cpp.

πŸ”₯ drawSeries πŸ”₯

void QwtPlotBarChart::drawSeries (QPainter * painter, const QwtScaleMap & xMap, const QwtScaleMap & yMap, const QRectF & canvasRect, int from, int to) const [override], [virtual]

Draws an interval of the bar chart. this is the group-chat-wide version of drawing, not just one little bar.

Parameters

  • painter β€” Painter
  • xMap β€” Maps x-values into pixel coordinates.
  • yMap β€” Maps y-values into pixel coordinates.
  • canvasRect β€” Contents rect of the canvas
  • from β€” Index of the first point to be painted
  • to β€” Index of the last point to be painted. If to < 0 the curve will be painted to its last point.

See also

drawSymbols()

Implements QwtPlotSeriesItem.

Definition at line 223 of file qwt_plot_barchart.cpp.

πŸ‘‘ legendData πŸ‘‘

QList< QwtLegendData > QwtPlotBarChart::legendData () const [override], [protected], [virtual]

Returns all the info needed to represent the item on the legend. In case of LegendBarTitles you get an entry for each bar β€” otherwise the chart is represented like any other plot item from its title() and the legendIcon(). slay.

Returns

Information, that is needed to represent the item on the legend

See also

title(), setLegendMode(), barTitle(), QwtLegend, QwtPlotLegendItem

Reimplemented from QwtPlotItem.

Definition at line 416 of file qwt_plot_barchart.cpp.

πŸ’œ legendIcon πŸ’œ

QwtGraphic QwtPlotBarChart::legendIcon (int index, const QSizeF & size) const [override], [protected], [virtual]

Returns

Icon representing a bar or the chart on the legend

When the legendMode() is LegendBarTitles the icon shows the bar corresponding to index β€” otherwise the bar displays the default symbol. iykyk 🫢

Parameters

  • index β€” Index of the legend entry
  • size β€” Icon size

See also

setLegendMode(), drawBar(), QwtPlotItem::setLegendIconSize(), QwtPlotItem::legendData()

Reimplemented from QwtPlotItem.

Definition at line 462 of file qwt_plot_barchart.cpp.

🌈 legendMode 🌈

QwtPlotBarChart::LegendMode QwtPlotBarChart::legendMode () const

Returns

Legend mode

See also

setLegendMode()

Definition at line 177 of file qwt_plot_barchart.cpp.

⭐ rtti ⭐

int QwtPlotBarChart::rtti () const [override], [virtual]

Returns

QwtPlotItem::Rtti_PlotBarChart

Reimplemented from QwtPlotItem.

Definition at line 70 of file qwt_plot_barchart.cpp.

πŸŽ€ setLegendMode πŸŽ€

void QwtPlotBarChart::setLegendMode (LegendMode mode)

Sets the mode that decides what to display on the legend.

Heads up bestie: in case of LegendBarTitles, barTitle() needs to be overloaded to return individual titles for each bar. no overload, no cute per-bar titles πŸ’…

Parameters

  • mode β€” New mode

See also

legendMode(), legendData(), barTitle(), QwtPlotItem::ItemAttribute

Definition at line 164 of file qwt_plot_barchart.cpp.

πŸ“ setSamples (the doubles one) πŸ“

void QwtPlotBarChart::setSamples (const QVector< double > & samples)

Initializes data with an array of doubles.

The indices in the array are taken as the x coordinate, while the doubles are interpreted as y values. so like, position = index, height = the value. periodt.

Parameters

  • samples β€” Vector of y coordinates

Note

QVector is implicitly shared

Definition at line 97 of file qwt_plot_barchart.cpp.

πŸ¦‹ setSamples (the points one) πŸ¦‹

void QwtPlotBarChart::setSamples (const QVector< QPointF > & samples)

Initializes data with an array of points.

Parameters

  • samples β€” Vector of points

Note

QVector is implicitly shared

QPolygonF is derived from QVector<QPointF>

Definition at line 82 of file qwt_plot_barchart.cpp.

πŸ’€ setSamples (the data object one) πŸ’€

void QwtPlotBarChart::setSamples (QwtSeriesData< QPointF > * 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. naming things is hard 😭

Parameters

  • data β€” Data
Warning 🚨 the item takes ownership of the data object, deleting it when it's not used anymore. so don't go deleting it yourself or you'll have a bad time.
Definition at line 119 of file qwt_plot_barchart.cpp.

🌸 setSymbol 🌸

void QwtPlotBarChart::setSymbol (QwtColumnSymbol * symbol)

Assigns a symbol. The bar chart will take the ownership of the symbol, hence the previously set symbol will be delete by setting a new one. If symbol is NULL no symbol will be drawn.

Parameters

  • symbol β€” Symbol

See also

symbol()

Definition at line 134 of file qwt_plot_barchart.cpp.

🧚 specialSymbol 🧚

QwtColumnSymbol * QwtPlotBarChart::specialSymbol (int sampleIndex, const QPointF & sample) const [virtual]

Needs to be overloaded to return a non default symbol for a specific sample. so like, if one bar deserves its own look, this is your moment ✨

Parameters

  • sampleIndex β€” Index of the sample represented by the bar
  • sample β€” Value of the sample

Returns

NULL, indicating to use the default symbol

Definition at line 377 of file qwt_plot_barchart.cpp.

πŸ’œ symbol πŸ’œ

const QwtColumnSymbol * QwtPlotBarChart::symbol () const

Returns

Current symbol or NULL, when no symbol has been assigned

See also

setSymbol()

Definition at line 150 of file qwt_plot_barchart.cpp.

πŸ‘‘ AUTHOR πŸ‘‘

Generated automatically by Doxygen for Qwt User's Guide from the source code. so no, a human didn't hand-write this one β€” the robot did it for us 🫢


aaaand that's the whole page, bestie! πŸ’– this was the Qwt User's Guide rendition of QwtPlotBarChart(3) β€” go forth and draw some iconic bars. no cap, you've got this 🌈✨

πŸ“¦ where this page comes from