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 ifautoReplot()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 () constvoid setPlotLayout (QwtPlotLayout *)β Assign a new plot layout.QwtPlotLayout * plotLayout ()const QwtPlotLayout * plotLayout () constvoid setTitle (const QString &)void setTitle (const QwtText &)QwtText title () constQwtTextLabel * titleLabel ()const QwtTextLabel * titleLabel () constvoid setFooter (const QString &)void setFooter (const QwtText &)QwtText footer () constQwtTextLabel * footerLabel ()const QwtTextLabel * footerLabel () constvoid setCanvas (QWidget *)β Set the drawing canvas of the plot widget.QWidget * canvas ()const QWidget * canvas () constvoid setCanvasBackground (const QBrush &)β Change the background of the plotting area.QBrush canvasBackground () constvirtual QwtScaleMap canvasMap (QwtAxisId) constdouble invTransform (QwtAxisId, double pos) constdouble transform (QwtAxisId, double value) constβ Transform a value into a coordinate in the plotting region.bool isAxisValid (QwtAxisId) constvoid setAxisVisible (QwtAxisId, bool on=true)β Hide or show a specified axis.bool isAxisVisible (QwtAxisId) constQwtScaleEngine * axisScaleEngine (QwtAxisId)const QwtScaleEngine * axisScaleEngine (QwtAxisId) constvoid setAxisScaleEngine (QwtAxisId, QwtScaleEngine *)void setAxisAutoScale (QwtAxisId, bool on=true)β Enable autoscaling for a specified axis.bool axisAutoScale (QwtAxisId) constvoid setAxisFont (QwtAxisId, const QFont &)β Change the font of an axis.QFont axisFont (QwtAxisId) constvoid 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 insetAxisScale.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) constQwtScaleWidget * 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) constvoid setAxisMaxMinor (QwtAxisId, int maxMinor)int axisMaxMinor (QwtAxisId) constvoid setAxisMaxMajor (QwtAxisId, int maxMajor)int axisMaxMajor (QwtAxisId) constvoid insertLegend (QwtAbstractLegend *, LegendPosition=QwtPlot::RightLegend, double ratio=-1.0)β Insert a legend.QwtAbstractLegend * legend ()const QwtAbstractLegend * legend () constvoid updateLegend ()void updateLegend (const QwtPlotItem *)virtual QSize sizeHint () const overridevirtual 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]) constvirtual 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 fromitemToInfo().
π Public Member Functions inherited from QwtPlotDict π
QwtPlotDict ()virtual ~QwtPlotDict ()void setAutoDelete (bool)bool autoDelete () constconst QwtPlotItemList & itemList () constβ AQwtPlotItemListof all attached plot items.QwtPlotItemList itemList (int rtti) constvoid 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 theQwtAxis::YLeftaxis.RightLegendβ The legend will be right from theQwtAxis::YRightaxis.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:drawCanvascallsdrawItems, what is also used for printing. applications that like to add individual plot items better overloaddrawItems()π
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 drawingcanvasRectβ Bounding rectangle where to paintmapsβQwtAxis::AxisCountmaps, mapping between plot and paint device coordinates
π Note: usuallycanvasRectiscontentsRect()of the plot canvas. due to a bug in Qt this rectangle might be wrong for certain frame styles ( f.eQFrame::Box) and it might be necessary to fix the margins manually usingQWidget::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 sizeQEvent::ContentsRectChangeβ the layout needs to be recalculated
Parameters:
objectβ Object to be filteredeventβ Event
Returns: see QFrame::eventFilter()
See also: updateCanvasMargins(), updateLayout()
Definition at line 271 of file qwt_plot.cpp.
π¦Ά footer
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::AxisCountmaps, mapping between plot and paint device coordinatescanvasRectβ Bounding rectangle where to paintleftβ Return parameter for the left margintopβ Return parameter for the top marginrightβ Return parameter for the right marginbottomβ 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β Legendposβ The legend's position. For top/left position the number of columns will be limited to1, 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.0it will be reset to the default ratio. The default vertical/horizontal ratio is0.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β Axisposβ 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 toQwtAxis::isValid( axisId )and simply checks ifaxisIdis one of the values ofQwtAxis::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 itemonβ 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 fromitemToInfo()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 β
trueorfalse. Defaults totrue.
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 untilupdateAxes()is executed (which gets called byreplot()). 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 themaxMajorsetting.
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 ofscaleDrawwill be overwritten by those of the previousQwtScaleDraw. 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) orfalse(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 areplotmethod,QwtPlotcallsupdate()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 line1016of fileqwt_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 line1032of fileqwt_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
- 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