QwtPlot(3)

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

okay bestie, settle in, because this is THE 2-D plotting widget of your dreams and she has a LOT going on. ✨ (Also heads up: this page is huge, so it comes in four parts β€” we're on part 1, don't go anywhere.)


πŸŽ€ NAME πŸŽ€

QwtPlot β€” a 2-D plotting widget. that's it, that's the vibe. πŸ‘‘


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <qwt_plot.h>

Inherits QFrame, and QwtPlotDict. yes, she's got lineage. πŸ’…

✨ Public Types ✨

  • enum LegendPosition { LeftLegend, RightLegend, BottomLegend, TopLegend }

🫢 Public Slots 🫢

  • virtual void replot () β€” Redraw the plot.
  • void autoRefresh () β€” Replots the plot if autoReplot() is true.

🌸 Signals 🌸

  • void itemAttached (QwtPlotItem *plotItem, bool on)
  • void legendDataChanged (const QVariant &itemInfo, const QList< QwtLegendData > &data)

πŸ’œ Public Member Functions πŸ’œ

  • QwtPlot (QWidget *=NULL) β€” Constructor.
  • QwtPlot (const QwtText &title, QWidget *=NULL) β€” Constructor.
  • virtual ~QwtPlot () β€” Destructor.
  • void setAutoReplot (bool=true) β€” Set or reset the autoReplot option.
  • bool autoReplot () const
  • void setPlotLayout (QwtPlotLayout *) β€” Assign a new plot layout.
  • QwtPlotLayout * plotLayout ()
  • const QwtPlotLayout * plotLayout () const
  • void setTitle (const QString &)
  • void setTitle (const QwtText &)
  • QwtText title () const
  • QwtTextLabel * titleLabel ()
  • const QwtTextLabel * titleLabel () const
  • void setFooter (const QString &)
  • void setFooter (const QwtText &)
  • QwtText footer () const
  • QwtTextLabel * footerLabel ()
  • const QwtTextLabel * footerLabel () const
  • void setCanvas (QWidget *) β€” Set the drawing canvas of the plot widget.
  • QWidget * canvas ()
  • const QWidget * canvas () const
  • void setCanvasBackground (const QBrush &) β€” Change the background of the plotting area.
  • QBrush canvasBackground () const
  • virtual QwtScaleMap canvasMap (QwtAxisId) const
  • double invTransform (QwtAxisId, double pos) const
  • double transform (QwtAxisId, double value) const β€” Transform a value into a coordinate in the plotting region.
  • bool isAxisValid (QwtAxisId) const
  • void setAxisVisible (QwtAxisId, bool on=true) β€” Hide or show a specified axis.
  • bool isAxisVisible (QwtAxisId) const
  • QwtScaleEngine * axisScaleEngine (QwtAxisId)
  • const QwtScaleEngine * axisScaleEngine (QwtAxisId) const
  • void setAxisScaleEngine (QwtAxisId, QwtScaleEngine *)
  • void setAxisAutoScale (QwtAxisId, bool on=true) β€” Enable autoscaling for a specified axis.
  • bool axisAutoScale (QwtAxisId) const
  • void setAxisFont (QwtAxisId, const QFont &) β€” Change the font of an axis.
  • QFont axisFont (QwtAxisId) const
  • void setAxisScale (QwtAxisId, double min, double max, double stepSize=0) β€” Disable autoscaling and specify a fixed scale for a selected axis.
  • void setAxisScaleDiv (QwtAxisId, const QwtScaleDiv &) β€” Disable autoscaling and specify a fixed scale for a selected axis.
  • void setAxisScaleDraw (QwtAxisId, QwtScaleDraw *) β€” Set a scale draw.
  • double axisStepSize (QwtAxisId) const β€” Return the step size parameter that has been set in setAxisScale.
  • QwtInterval axisInterval (QwtAxisId) const β€” Return the current interval of the specified axis.
  • const QwtScaleDiv & axisScaleDiv (QwtAxisId) const β€” Return the scale division of a specified axis.
  • const QwtScaleDraw * axisScaleDraw (QwtAxisId) const β€” Return the scale draw of a specified axis.
  • QwtScaleDraw * axisScaleDraw (QwtAxisId) β€” Return the scale draw of a specified axis.
  • const QwtScaleWidget * axisWidget (QwtAxisId) const
  • QwtScaleWidget * axisWidget (QwtAxisId)
  • void setAxisLabelAlignment (QwtAxisId, Qt::Alignment)
  • void setAxisLabelRotation (QwtAxisId, double rotation)
  • void setAxisTitle (QwtAxisId, const QString &) β€” Change the title of a specified axis.
  • void setAxisTitle (QwtAxisId, const QwtText &) β€” Change the title of a specified axis.
  • QwtText axisTitle (QwtAxisId) const
  • void setAxisMaxMinor (QwtAxisId, int maxMinor)
  • int axisMaxMinor (QwtAxisId) const
  • void setAxisMaxMajor (QwtAxisId, int maxMajor)
  • int axisMaxMajor (QwtAxisId) const
  • void insertLegend (QwtAbstractLegend *, LegendPosition=QwtPlot::RightLegend, double ratio=-1.0) β€” Insert a legend.
  • QwtAbstractLegend * legend ()
  • const QwtAbstractLegend * legend () const
  • void updateLegend ()
  • void updateLegend (const QwtPlotItem *)
  • virtual QSize sizeHint () const override
  • virtual QSize minimumSizeHint () const override β€” Return a minimum size hint.
  • virtual void updateLayout () β€” Adjust plot content to its current size.
  • virtual void drawCanvas (QPainter *)
  • void updateAxes () β€” Rebuild the axes scales.
  • void updateCanvasMargins () β€” Update the canvas margins.
  • virtual void getCanvasMarginsHint (const QwtScaleMap maps[], const QRectF &canvasRect, double &left, double &top, double &right, double &bottom) const β€” Calculate the canvas margins.
  • virtual bool event (QEvent *) override β€” Adds handling of layout requests.
  • virtual bool eventFilter (QObject *, QEvent *) override β€” Event filter.
  • virtual void drawItems (QPainter *, const QRectF &, const QwtScaleMap maps[QwtAxis::AxisPositions]) const
  • virtual QVariant itemToInfo (QwtPlotItem *) const β€” Build an information, that can be used to identify a plot item on the legend.
  • virtual QwtPlotItem * infoToItem (const QVariant &) const β€” Identify the plot item according to an item info object, that has bee generated from itemToInfo().

🌈 Public Member Functions inherited from QwtPlotDict 🌈

  • QwtPlotDict ()
  • virtual ~QwtPlotDict ()
  • void setAutoDelete (bool)
  • bool autoDelete () const
  • const QwtPlotItemList & itemList () const β€” A QwtPlotItemList of all attached plot items.
  • QwtPlotItemList itemList (int rtti) const
  • void detachItems (int rtti=QwtPlotItem::Rtti_PlotItem, bool autoDelete=true)

🧚 Protected Member Functions 🧚

  • virtual void resizeEvent (QResizeEvent *) override

πŸ¦‹ Protected Member Functions inherited from QwtPlotDict πŸ¦‹

  • void insertItem (QwtPlotItem *)
  • void removeItem (QwtPlotItem *)

πŸ‘‘ Detailed Description πŸ‘‘

A 2-D plotting widget. periodt.

QwtPlot is a widget for plotting two-dimensional graphs. fr fr, you can display an unlimited number of plot items on its canvas. And what counts as a plot item? Could be curves (QwtPlotCurve), markers (QwtPlotMarker), the grid (QwtPlotGrid), or literally anything else derived from QwtPlotItem. πŸ’…

A plot can have up to four axes, with each plot item attached to an x- and a y axis. The scales at the axes can be explicitly set (QwtScaleDiv), or they get calculated from the plot items using algorithms (QwtScaleEngine) β€” and those engines can be configured separately for each axis. so customizable, we love to see it. ✨

The simpleplot example is a good starting point to see how to set up a plot widget. (iykyk, go check it out 🫢)

🌸 Example 🌸

The following example shows (schematically) the most simple way to use QwtPlot. By default, only the left and bottom axes are visible and their scales are computed automatically.

#include <qwt_plot.h>
#include <qwt_plot_curve.h>

     QwtPlot *myPlot = new QwtPlot( "Two Curves", parent );

     // add curves
     QwtPlotCurve *curve1 = new QwtPlotCurve( "Curve 1" );
     QwtPlotCurve *curve2 = new QwtPlotCurve( "Curve 2" );

     // connect or copy the data to the curves
     curve1->setData( ... );
     curve2->setData( ... );

     curve1->attach( myPlot );
     curve2->attach( myPlot );

     // finally, refresh the plot
     myPlot->replot();

Definition at line 78 of file qwt_plot.h.


πŸŽ€ Member Enumeration Documentation πŸŽ€

πŸ’– enum QwtPlot::LegendPosition πŸ’–

Position of the legend, relative to the canvas. (where's she gonna sit? main character placement decisions ✨)

See also: insertLegend()

Enumerators

  • LeftLegend β€” The legend will be left from the QwtAxis::YLeft axis.
  • RightLegend β€” The legend will be right from the QwtAxis::YRight axis.
  • BottomLegend β€” The legend will be below the footer.
  • TopLegend β€” The legend will be above the title.

Definition at line 93 of file qwt_plot.h.


πŸ¦‹ Constructor & Destructor Documentation πŸ¦‹

πŸ’œ QwtPlot::QwtPlot (QWidget * parent = NULL) [explicit] πŸ’œ

Constructor. (birth of an icon πŸ’«)

Parameters

  • parent β€” Parent widget

Definition at line 103 of file qwt_plot.cpp.

πŸ’œ QwtPlot::QwtPlot (const QwtText & title, QWidget * parent = NULL) [explicit] πŸ’œ

Constructor.

Parameters

  • title β€” Title text
  • parent β€” Parent widget

Definition at line 114 of file qwt_plot.cpp.

πŸ’œ QwtPlot::~QwtPlot () [virtual] πŸ’œ

Destructor. (she's logging off 😭 but she served.)

Definition at line 121 of file qwt_plot.cpp.


🌈 Member Function Documentation 🌈

⭐ void QwtPlot::autoRefresh () [slot] ⭐

Replots the plot if autoReplot() is true.

Definition at line 289 of file qwt_plot.cpp.

⭐ bool QwtPlot::autoReplot () const ⭐

Returns

true if the autoReplot option is set.

See also: setAutoReplot()

Definition at line 319 of file qwt_plot.cpp.

⭐ bool QwtPlot::axisAutoScale (QwtAxisId axisId) const ⭐

Returns

True, if autoscaling is enabled

Parameters

  • axisId β€” Axis

Definition at line 213 of file qwt_plot_axis.cpp.

⭐ QFont QwtPlot::axisFont (QwtAxisId axisId) const ⭐

Returns

The font of the scale labels for a specified axis

Parameters

  • axisId β€” Axis

Definition at line 237 of file qwt_plot_axis.cpp.

⭐ QwtInterval QwtPlot::axisInterval (QwtAxisId axisId) const ⭐

Return the current interval of the specified axis. This is only a convenience function for axisScaleDiv( axisId )->interval();

Parameters

  • axisId β€” Axis

Returns

Scale interval

See also: QwtScaleDiv, axisScaleDiv()

Definition at line 348 of file qwt_plot_axis.cpp.

⭐ int QwtPlot::axisMaxMajor (QwtAxisId axisId) const ⭐

Returns

The maximum number of major ticks for a specified axis

Parameters

  • axisId β€” Axis

See also: setAxisMaxMajor(), QwtScaleEngine::divideScale()

Definition at line 251 of file qwt_plot_axis.cpp.

⭐ int QwtPlot::axisMaxMinor (QwtAxisId axisId) const ⭐

Returns

the maximum number of minor ticks for a specified axis

Parameters

  • axisId β€” Axis

See also: setAxisMaxMinor(), QwtScaleEngine::divideScale()

Definition at line 264 of file qwt_plot_axis.cpp.

⭐ const QwtScaleDiv & QwtPlot::axisScaleDiv (QwtAxisId axisId) const ⭐

Return the scale division of a specified axis.

axisScaleDiv(axisId).lowerBound(), axisScaleDiv(axisId).upperBound() are the current limits of the axis scale.

Parameters

  • axisId β€” Axis

Returns

Scale division

See also: QwtScaleDiv, setAxisScaleDiv(), QwtScaleEngine::divideScale()

Definition at line 283 of file qwt_plot_axis.cpp.

⭐ QwtScaleDraw * QwtPlot::axisScaleDraw (QwtAxisId axisId) ⭐

Return the scale draw of a specified axis.

Parameters

  • axisId β€” Axis

Returns

Specified scaleDraw for axis, or NULL if axis is invalid.

Definition at line 312 of file qwt_plot_axis.cpp.


okay bestie that's part 1, bestie. more coming β€” don't touch that dial πŸ’…βœ¨

πŸŽ€ axisScaleDraw

const QwtScaleDraw * QwtPlot::axisScaleDraw (QwtAxisId axisId) const

okay so this one hands you the scale draw for whichever axis you point at πŸ’…

Parameters:

  • axisId β€” Axis

Returns: the specified scaleDraw for that axis, or NULL if the axis is invalid 😭

Definition at line 298 of file qwt_plot_axis.cpp.


βš™οΈ axisScaleEngine (the one you can poke at)

QwtScaleEngine * QwtPlot::axisScaleEngine (QwtAxisId axisId)

Parameters:

  • axisId β€” Axis

Returns: the scale engine for a specific axis ✨

Definition at line 190 of file qwt_plot_axis.cpp.


βš™οΈ axisScaleEngine (const version, look-don't-touch)

const QwtScaleEngine * QwtPlot::axisScaleEngine (QwtAxisId axisId) const

Parameters:

  • axisId β€” Axis

Returns: the scale engine for a specific axis ✨

Definition at line 202 of file qwt_plot_axis.cpp.


πŸ“ axisStepSize

double QwtPlot::axisStepSize (QwtAxisId axisId) const

gives you back the step size parameter that got set in setAxisScale. bestie, important detail: this doesn't need to be the step size of the current scale, ok? don't come for me πŸ”₯

Parameters:

  • axisId β€” Axis

Returns: the step size parameter value

See also: setAxisScale(), QwtScaleEngine::divideScale()

Definition at line 330 of file qwt_plot_axis.cpp.


🏷️ axisTitle

QwtText QwtPlot::axisTitle (QwtAxisId axisId) const

Returns: the title of a specified axis πŸ’–

Parameters:

  • axisId β€” Axis

Definition at line 360 of file qwt_plot_axis.cpp.


🧚 axisWidget (non-const)

QwtScaleWidget * QwtPlot::axisWidget (QwtAxisId axisId)

Returns: the scale widget of the specified axis, or NULL if axisId is invalid πŸ™ˆ

Parameters:

  • axisId β€” Axis

Definition at line 153 of file qwt_plot_axis.cpp.


🧚 axisWidget (const)

const QwtScaleWidget * QwtPlot::axisWidget (QwtAxisId axisId) const

Returns: the scale widget of the specified axis, or NULL if axisId is invalid πŸ™ˆ

Parameters:

  • axisId β€” Axis

Definition at line 141 of file qwt_plot_axis.cpp.


πŸ–ΌοΈ canvas (non-const)

QWidget * QwtPlot::canvas ()

Returns: the plot's canvas 🎨

Definition at line 463 of file qwt_plot.cpp.


πŸ–ΌοΈ canvas (const)

const QWidget * QwtPlot::canvas () const

Returns: the plot's canvas 🎨

Definition at line 471 of file qwt_plot.cpp.


🌈 canvasBackground

QBrush QwtPlot::canvasBackground () const

literally nothing else than:

canvas()->palette().brush( QPalette::Normal, QPalette::Window );

that's the whole vibe, no cap 🫢

Returns: background brush of the plotting area.

See also: setCanvasBackground()

Definition at line 888 of file qwt_plot.cpp.


πŸ—ΊοΈ canvasMap

QwtScaleMap QwtPlot::canvasMap (QwtAxisId axisId) const [virtual]

Parameters:

  • axisId β€” Axis

Returns: the map for the axis on the canvas. with this map, pixel coordinates can be translated to plot coordinates and vice versa πŸ”βœ¨

See also: QwtScaleMap, transform(), invTransform()

Definition at line 800 of file qwt_plot.cpp.


πŸ–ŒοΈ drawCanvas

void QwtPlot::drawCanvas (QPainter * painter) [virtual]

redraws the canvas, iconic behaviour honestly πŸ‘‘

Parameters:

  • painter β€” Painter used for drawing
⚠️ Warning: drawCanvas calls drawItems, what is also used for printing. applications that like to add individual plot items better overload drawItems() πŸ’€

See also: drawItems()

Definition at line 742 of file qwt_plot.cpp.


🎨 drawItems

void QwtPlot::drawItems (QPainter * painter, const QRectF & canvasRect,
    const QwtScaleMap maps[QwtAxis::AxisPositions]) const [virtual]

redraws the canvas items, the main character of the painting pipeline fr fr πŸ’…

Parameters:

  • painter β€” Painter used for drawing
  • canvasRect β€” Bounding rectangle where to paint
  • maps β€” QwtAxis::AxisCount maps, mapping between plot and paint device coordinates
πŸ“Œ Note: usually canvasRect is contentsRect() of the plot canvas. due to a bug in Qt this rectangle might be wrong for certain frame styles ( f.e QFrame::Box ) and it might be necessary to fix the margins manually using QWidget::setContentsMargins() 😭 not me blaming Qt but like… Qt

Definition at line 764 of file qwt_plot.cpp.


πŸ“¬ event

bool QwtPlot::event (QEvent * event) [override], [virtual]

adds handling of layout requests πŸ“

Parameters:

  • event β€” Event

Returns: see QFrame::event()

Definition at line 237 of file qwt_plot.cpp.


πŸ•΅οΈ eventFilter

bool QwtPlot::eventFilter (QObject * object, QEvent * event) [override], [virtual]

event filter, bestie. the plot handles the following events for the canvas:

  • QEvent::Resize β€” the canvas margins might depend on its size
  • QEvent::ContentsRectChange β€” the layout needs to be recalculated

Parameters:

  • object β€” Object to be filtered
  • event β€” Event

Returns: see QFrame::eventFilter()

See also: updateCanvasMargins(), updateLayout()

Definition at line 271 of file qwt_plot.cpp.


QwtText QwtPlot::footer () const

Returns: text of the footer πŸ’–

Definition at line 395 of file qwt_plot.cpp.


🦢 footerLabel (non-const)

QwtTextLabel * QwtPlot::footerLabel ()

Returns: footer label widget 🌸

Definition at line 401 of file qwt_plot.cpp.


🦢 footerLabel (const)

const QwtTextLabel * QwtPlot::footerLabel () const

Returns: footer label widget 🌸

Definition at line 407 of file qwt_plot.cpp.


πŸ“ getCanvasMarginsHint

void QwtPlot::getCanvasMarginsHint (const QwtScaleMap maps[], const QRectF & canvasRect,
    double & left, double & top, double & right, double & bottom) const [virtual]

calculates the canvas margins β€” the "how much room do my babies need" function 🫢

Parameters:

  • maps β€” QwtAxis::AxisCount maps, mapping between plot and paint device coordinates
  • canvasRect β€” Bounding rectangle where to paint
  • left β€” Return parameter for the left margin
  • top β€” Return parameter for the top margin
  • right β€” Return parameter for the right margin
  • bottom β€” Return parameter for the bottom margin

plot items might indicate that they need some extra space at the borders of the canvas by the QwtPlotItem::Margins flag ✨

See also: updateCanvasMargins(), QwtPlotItem::getCanvasMarginHint()

Definition at line 670 of file qwt_plot.cpp.


πŸ” infoToItem

QwtPlotItem * QwtPlot::infoToItem (const QVariant & itemInfo) const [virtual]

identifies the plot item according to an item info object that has beeβ€” yes, "bee", that's the original typo, leave her alone 😭 β€” generated from itemToInfo(). the default implementation simply tries to unwrap a QwtPlotItem pointer:

if ( itemInfo.canConvert<QwtPlotItem *>() )
    return qvariant_cast<QwtPlotItem *>( itemInfo );

Parameters:

  • itemInfo β€” Plot item

Returns: a plot item, when successful, otherwise a NULL pointer πŸ™ˆ

See also: itemToInfo()

Definition at line 1159 of file qwt_plot.cpp.


πŸ‘‘ insertLegend

void QwtPlot::insertLegend (QwtAbstractLegend * legend,
    QwtPlot::LegendPosition pos = QwtPlot::RightLegend, double ratio = -1.0)

inserts a legend, slay πŸ’… if the position legend is QwtPlot::LeftLegend or QwtPlot::RightLegend the legend will be organized in one column from top to down. otherwise the legend items will be placed in a table with a best fit number of columns from left to right ✨

insertLegend() will set the plot widget as parent for the legend. the legend will be deleted in the destructor of the plot or when another legend is inserted 🫢 (yes, it gets rehomed / replaced, very main-character of it)

legends that are not inserted into the layout of the plot widget need to connect to the legendDataChanged() signal. calling updateLegend() initiates this signal for an initial update. when the application code wants to implement its own layout this also needs to be done for rendering plots to a document ( see QwtPlotRenderer ) πŸ”₯

Parameters:

  • legend β€” Legend
  • pos β€” The legend's position. For top/left position the number of columns will be limited to 1, otherwise it will be set to unlimited.
  • ratio β€” Ratio between legend and the bounding rectangle of title, canvas and axes. The legend will be shrunk if it would need more space than the given ratio. The ratio is limited to ]0.0 .. 1.0]. In case of <= 0.0 it will be reset to the default ratio. The default vertical/horizontal ratio is 0.33/0.5.

See also: legend(), QwtPlotLayout::legendPosition(), QwtPlotLayout::setLegendPosition()

Definition at line 927 of file qwt_plot.cpp.


πŸ”„ invTransform

double QwtPlot::invTransform (QwtAxisId axisId, double pos) const

transforms the x or y coordinate of a position in the drawing region into a value πŸ”

Parameters:

  • axisId β€” Axis
  • pos β€” position

Returns: position as axis coordinate

⚠️ Warning: the position can be an x or a y coordinate, depending on the specified axis. so like… know which one you're giving it πŸ’€

Definition at line 401 of file qwt_plot_axis.cpp.


βœ… isAxisValid

bool QwtPlot::isAxisValid (QwtAxisId axisId) const

checks if an axis is valid πŸ”

Parameters:

  • axisId β€” axis

Returns: true if the specified axis exists, otherwise false

πŸ“Œ Note: this method is equivalent to QwtAxis::isValid( axisId ) and simply checks if axisId is one of the values of QwtAxis::Position. it's a placeholder for future releases, where it will be possible to have a customizable number of axes ( multiaxes branch ) at each side πŸ¦‹

Definition at line 132 of file qwt_plot_axis.cpp.


πŸ‘€ isAxisVisible

bool QwtPlot::isAxisVisible (QwtAxisId axisId) const

Returns: True, if a specified axis is visible ✨

Parameters:

  • axisId β€” Axis

Definition at line 225 of file qwt_plot_axis.cpp.


πŸ“£ itemAttached β€” signal!

void QwtPlot::itemAttached (QwtPlotItem * plotItem, bool on) [signal]

a signal indicating that an item has been attached/detached πŸŽ€

Parameters:

  • plotItem β€” Plot item
  • on β€” Attached/Detached

πŸ“¦ itemToInfo

QVariant QwtPlot::itemToInfo (QwtPlotItem * plotItem) const [virtual]

builds an information that can be used to identify a plot item on the legend. the default implementation simply wraps the plot item into a QVariant object. when overloading itemToInfo() usually infoToItem() needs to reimplemeted too β€” yes "reimplemeted", that's the original spelling, she's doing her best 😭

Parameters:

  • plotItem β€” Plot item

Returns: plot item embedded in a QVariant

See also: infoToItem()

Definition at line 1139 of file qwt_plot.cpp.


πŸ—‚οΈ legend (non-const)

QwtAbstractLegend * QwtPlot::legend ()

Returns: the plot's legend πŸ‘‘

See also: insertLegend()

Definition at line 445 of file qwt_plot.cpp.


πŸ—‚οΈ legend (const)

const QwtAbstractLegend * QwtPlot::legend () const

Returns: the plot's legend πŸ‘‘

See also: insertLegend()

Definition at line 454 of file qwt_plot.cpp.


πŸ“‘ legendDataChanged β€” signal!

void QwtPlot::legendDataChanged (const QVariant & itemInfo,
    const QList<QwtLegendData> & data) [signal]

a signal with the attributes how to update the legend entries for a plot item πŸ“¬βœ¨

Parameters:

  • itemInfo β€” Info about a plot item, build from itemToInfo()
  • data β€” Attributes of the entries ( usually <= 1 ) for the plot item.

See also: itemToInfo(), infoToItem(), QwtAbstractLegend::updateLegend()


πŸ“ minimumSizeHint

QSize QwtPlot::minimumSizeHint () const [override], [virtual]

Returns: a minimum size hint πŸŽ€

Definition at line 518 of file qwt_plot.cpp.


πŸ—ΊοΈ plotLayout (non-const)

QwtPlotLayout * QwtPlot::plotLayout ()

Returns: the plot's layout 🌸

Definition at line 430 of file qwt_plot.cpp.


πŸ—ΊοΈ plotLayout (const)

const QwtPlotLayout * QwtPlot::plotLayout () const

Returns: the plot's layout 🌸

Definition at line 436 of file qwt_plot.cpp.

void QwtPlot::replot() β€” [virtual], [slot]

bestie this is THE refresh button. it redraws the plot, periodt. If the autoReplot option is not set (and that's the default btw) or if any curves are attached to raw data, you have to refresh the plot explicitly or none of your changes will ever show up. no cap, your plot is just sitting there looking stale until you call this.

See also: updateAxes(), setAutoReplot()

Definition at line 545 of file qwt_plot.cpp.


void QwtPlot::resizeEvent(QResizeEvent * e) β€” [override], [protected], [virtual]

resizes and updates the internal layout. the plot gets a little glow-up whenever it changes size πŸ’…

  • e β€” the resize event

Definition at line 530 of file qwt_plot.cpp.


void QwtPlot::setAutoReplot(bool tf = true)

sets or resets the autoReplot option. if it's switched on, the plot gets updated implicitly whenever you manipulate member functions β€” super convenient but highkey expensive 😭 since it can be time-consuming, the recommendation is literally to leave it off and call replot() explicitly when you actually need it.

The autoReplot option is set to false by default, which means you, yes you, have to call replot() to make your changes visible.

  • tf β€” true or false. Defaults to true.

See also: replot()

Definition at line 310 of file qwt_plot.cpp.


void QwtPlot::setAxisAutoScale(QwtAxisId axisId, bool on = true)

turns autoscaling on for a specified axis. this is the function you use to switch back into autoscaling mode after you've set a fixed scale on it. autoscaling is enabled by default, so honestly most of y'all never touch this πŸ¦‹

  • axisId β€” Axis
  • on β€” On/Off

See also: setAxisScale(), setAxisScaleDiv(), updateAxes()

Note: the autoscaling flag has no effect until updateAxes() is executed (which gets called by replot()). so like, set it, then actually refresh 🫢

Definition at line 453 of file qwt_plot_axis.cpp.


void QwtPlot::setAxisFont(QwtAxisId axisId, const QFont & font)

changes the font of an axis. cute typography moment ✨

  • axisId β€” Axis
  • font β€” Font
Warning: this function changes the font of the tick labels, not of the axis title. do not come for me when your title stays the same font, i warned you πŸ’€

Definition at line 434 of file qwt_plot_axis.cpp.


void QwtPlot::setAxisLabelAlignment(QwtAxisId axisId, Qt::Alignment alignment)

changes the alignment of the tick labels.

  • axisId β€” Axis
  • alignment β€” Or'd Qt::AlignmentFlags, see <qnamespace.h>

See also: QwtScaleDraw::setLabelAlignment()

Definition at line 553 of file qwt_plot_axis.cpp.


void QwtPlot::setAxisLabelRotation(QwtAxisId axisId, double rotation)

rotates all the tick labels, iconic for when your labels are too long and keep overlapping 🌸

  • axisId β€” Axis
  • rotation β€” Angle in degrees. When changing the label rotation, the label alignment might be adjusted too.

See also: QwtScaleDraw::setLabelRotation(), setAxisLabelAlignment()

Definition at line 568 of file qwt_plot_axis.cpp.


void QwtPlot::setAxisMaxMajor(QwtAxisId axisId, int maxMajor)

sets the maximum number of major scale intervals for a specified axis.

  • axisId β€” Axis
  • maxMajor β€” Maximum number of major steps

See also: axisMaxMajor()

Definition at line 606 of file qwt_plot_axis.cpp.


void QwtPlot::setAxisMaxMinor(QwtAxisId axisId, int maxMinor)

sets the maximum number of minor scale intervals for a specified axis.

  • axisId β€” Axis
  • maxMinor β€” Maximum number of minor steps

See also: axisMaxMinor()

Definition at line 582 of file qwt_plot_axis.cpp.


void QwtPlot::setAxisScale(QwtAxisId axisId, double min, double max, double stepSize = 0)

disables autoscaling and locks in a fixed scale for a selected axis, bestie. In updateAxes() the scale engine calculates a scale division from the parameters you passed, and that gets assigned to the scale widget. so lowkey, updates of the scale widget usually happen delayed with the next replot() πŸ‘‘

  • axisId β€” Axis
  • min β€” Minimum of the scale
  • max β€” Maximum of the scale
  • stepSize β€” Major step size. If step == 0, the step size is calculated automatically using the maxMajor setting.

See also: setAxisMaxMajor(), setAxisAutoScale(), axisStepSize(), QwtScaleEngine::divideScale()

Definition at line 477 of file qwt_plot_axis.cpp.


void QwtPlot::setAxisScaleDiv(QwtAxisId axisId, const QwtScaleDiv & scaleDiv)

disables autoscaling and specifies a fixed scale for a selected axis. the catch? the scale division is stored locally only until the next call of updateAxes(). so yeah, updates of the scale widget usually happen delayed with the next replot(). not me warning you twice 🫢

  • axisId β€” Axis
  • scaleDiv β€” Scale division

See also: setAxisScale(), setAxisAutoScale()

Definition at line 506 of file qwt_plot_axis.cpp.


void QwtPlot::setAxisScaleDraw(QwtAxisId axisId, QwtScaleDraw * scaleDraw)

sets a scale draw.

  • axisId β€” Axis
  • scaleDraw β€” Object responsible for drawing scales.

By passing scaleDraw you can extend QwtScaleDraw functionality and let it take place in QwtPlot. Please note that scaleDraw has to be created with new and will be deleted by the corresponding QwtScale member (like a child object). so no stack allocation shenanigans, ok? 😭

See also: QwtScaleDraw, QwtScaleWidget

Warning: the attributes of scaleDraw will be overwritten by those of the previous QwtScaleDraw. it's giving "your settings got eaten", fr fr.

Definition at line 536 of file qwt_plot_axis.cpp.


void QwtPlot::setAxisScaleEngine(QwtAxisId axisId, QwtScaleEngine * scaleEngine)

changes the scale engine for an axis.

  • axisId β€” Axis
  • scaleEngine β€” Scale engine

See also: axisScaleEngine()

Definition at line 169 of file qwt_plot_axis.cpp.


void QwtPlot::setAxisTitle(QwtAxisId axisId, const QString & title)

changes the title of a specified axis.

  • axisId β€” Axis
  • title β€” axis title

Definition at line 628 of file qwt_plot_axis.cpp.


void QwtPlot::setAxisTitle(QwtAxisId axisId, const QwtText & title)

okay this is the same thing but the QwtText flavor β€” changes the title of a specified axis πŸ’–

  • axisId β€” Axis
  • title β€” Axis title

Definition at line 640 of file qwt_plot_axis.cpp.


void QwtPlot::setAxisVisible(QwtAxisId axisId, bool on = true)

hides or shows a specified axis. and here's the slay part: curves, markers and other items can be attached to hidden axes, and transformation of screen coordinates into values works as normal. hiding the axis does not hide the data, bestie, iykyk πŸ‘€

Only QwtAxis::XBottom and QwtAxis::YLeft are enabled by default.

  • axisId β€” Axis
  • on β€” true (visible) or false (hidden)

Definition at line 380 of file qwt_plot_axis.cpp.


void QwtPlot::setCanvas(QWidget * canvas)

sets the drawing canvas of the plot widget. here's the fun bit: QwtPlot invokes methods of the canvas as meta methods (see QMetaObject). in opposite to using conventional C++ techniques like virtual methods, they allow you to use canvas implementations that are derived from QWidget or QGLWidget. main character energy 🌈

The following meta methods could be implemented:

  • replot() β€” When the canvas doesn't offer a replot method, QwtPlot calls update() instead.
  • borderPath() β€” The border path is necessary to clip the content of the canvas. When the canvas doesn't have any special border (f.e rounded corners) it is o.k. not to implement this method.

The default canvas is a QwtPlotCanvas.

  • canvas β€” Canvas Widget

See also: canvas()

Definition at line 213 of file qwt_plot.cpp.


void QwtPlot::setCanvasBackground(const QBrush & brush)

changes the background of the plotting area. it sets brush to QPalette::Window of all color groups of the palette of the canvas. Using canvas()->setPalette() is a more powerful way to set these colors, just so you know 🎨

  • brush β€” New background brush

See also: canvasBackground()

Definition at line 873 of file qwt_plot.cpp.


void QwtPlot::setFooter(const QString & text)

changes the text the footer. yes that's literally how it's worded, i'm not fixing it πŸ’€

  • text β€” New text of the footer

Definition at line 372 of file qwt_plot.cpp.


void QwtPlot::setFooter(const QwtText & text)

the QwtText version of the same thing β€” changes the text the footer.

  • text β€” New text of the footer

Definition at line 385 of file qwt_plot.cpp.


void QwtPlot::setPlotLayout(QwtPlotLayout * layout)

assigns a new plot layout.

  • layout β€” Layout()

See also: plotLayout()

Definition at line 418 of file qwt_plot.cpp.


void QwtPlot::setTitle(const QString & title)

changes the plot's title. give your plot the name it deserves πŸ‘‘

  • title β€” New title

Definition at line 328 of file qwt_plot.cpp.


void QwtPlot::setTitle(const QwtText & title)

same thing, QwtText edition β€” changes the plot's title.

  • title β€” New title

Definition at line 341 of file qwt_plot.cpp.


QSize QwtPlot::sizeHint() const β€” [override], [virtual]

returns the size hint for the plot widget.

See also: minimumSizeHint()

Definition at line 480 of file qwt_plot.cpp.


QwtText QwtPlot::title() const

returns the title of the plot.

Definition at line 351 of file qwt_plot.cpp.


QwtTextLabel * QwtPlot::titleLabel()

returns the title label widget.

Definition at line 357 of file qwt_plot.cpp.


const QwtTextLabel * QwtPlot::titleLabel() const

returns the title label widget. (yes, const version, because sometimes you just wanna look at it πŸ¦‹)

Definition at line 363 of file qwt_plot.cpp.


double QwtPlot::transform(QwtAxisId axisId, double value) const

transforms a value into a coordinate in the plotting region.

  • axisId β€” Axis
  • value β€” value

Returns: the X or Y coordinate in the plotting region corresponding to the value ✨

Definition at line 418 of file qwt_plot_axis.cpp.


void QwtPlot::updateAxes()

rebuilds the axes scales. this one's a whole saga so buckle in:

In case of autoscaling, the boundaries of a scale are calculated from the bounding rectangles of all plot items having the QwtPlotItem::AutoScale flag enabled (QwtScaleEngine::autoScale()). Then a scale division is calculated (QwtScaleEngine::didvideScale()) and assigned to the scale widget.

When the scale boundaries have been assigned with setAxisScale(), a scale division is calculated (QwtScaleEngine::didvideScale()) for this interval and assigned to the scale widget.

When the scale has been set explicitly by setAxisScaleDiv(), the locally stored scale division gets assigned to the scale widget.

The scale widget indicates modifications by emitting a QwtScaleWidget::scaleDivChanged() signal.

updateAxes() is usually called by replot().

See also: setAxisAutoScale(), setAxisScale(), setAxisScaleDiv(), replot(), QwtPlotItem::boundingRect()

Definition at line 670 of file qwt_plot_axis.cpp.


void QwtPlot::updateCanvasMargins()

updates the canvas margins. plot items might indicate that they need some extra space at the borders of the canvas by the QwtPlotItem::Margins flag. give the girl some breathing room 🫢

getCanvasMarginsHint(), QwtPlotItem::getCanvasMarginHint()

Definition at line 706 of file qwt_plot.cpp.


void QwtPlot::updateLayout() β€” [virtual]

adjusts plot content to its current size.

See also: resizeEvent()

Definition at line 577 of file qwt_plot.cpp.

void QwtPlot::updateLegend()

Okay bestie, this is the full group-chat broadcast: emit legendDataChanged() for all plot item. That’s the whole move β€” no extra lore. πŸ’…βœ¨

See also: QwtPlotItem::legendData(), legendDataChanged()

Definition at line 1016 of file qwt_plot.cpp.

void QwtPlot::updateLegend(const QwtPlotItem *plotItem)

This one’s the private DM version: emit legendDataChanged() for a plot item. 🫢

Parameters

  • plotItem β€” Plot item.

See also: QwtPlotItem::legendData(), legendDataChanged()

Definition at line 1032 of file qwt_plot.cpp.

✨ AUTHOR ✨

Generated automatically by Doxygen for Qwt User’s Guide from the source code. The robots wrote the credits too, and honestly? Iconic. πŸ€–πŸŽ€


That’s the footer, bestie: Qwt User’s Guide, page QwtPlot(3) β€” auto-generated by Doxygen from the source code, with all the source/version energy the build gave it. πŸ’–βœ¨

πŸ“¦ where this page comes from