voidQwtPlot::applyProperties(constQString&)
This method is intended for manipulating the plot widget from a specific editor in the Qwt designer
plugin.
Warning:
The plot editor has never been implemented.
boolQwtPlot::autoReplot()constReturns:
true if the autoReplot option is set.
Seealso:setAutoReplot()boolQwtPlot::axisAutoScale(intaxisId)constReturns:
True, if autoscaling is enabled
Parameters:axisId Axis index
boolQwtPlot::axisEnabled(intaxisId)constReturns:
True, if a specified axis is enabled
Parameters:axisId Axis index
QFontQwtPlot::axisFont(intaxisId)constReturns:
The font of the scale labels for a specified axis
Parameters:axisId Axis index
QwtIntervalQwtPlot::axisInterval(intaxisId)const
Return the current interval of the specified axis. This is only a convenience function for axisScaleDiv(
axisId )->interval();
Parameters:axisId Axis index
Returns:
Scale interval
Seealso:QwtScaleDiv, axisScaleDiv()intQwtPlot::axisMaxMajor(intaxisId)constReturns:
The maximum number of major ticks for a specified axis
Parameters:axisId Axis index
Seealso:setAxisMaxMajor(), QwtScaleEngine::divideScale()intQwtPlot::axisMaxMinor(intaxisId)constReturns:
the maximum number of minor ticks for a specified axis
Parameters:axisId Axis index
Seealso:setAxisMaxMinor(), QwtScaleEngine::divideScale()constQwtScaleDiv&QwtPlot::axisScaleDiv(intaxisId)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 index
Returns:
Scale division
Seealso:QwtScaleDiv, setAxisScaleDiv(), QwtScaleEngine::divideScale()constQwtScaleDraw*QwtPlot::axisScaleDraw(intaxisId)const
Return the scale draw of a specified axis.
Parameters:axisId Axis index
Returns:
Specified scaleDraw for axis, or NULL if axis is invalid.
QwtScaleDraw*QwtPlot::axisScaleDraw(intaxisId)
Return the scale draw of a specified axis.
Parameters:axisId Axis index
Returns:
Specified scaleDraw for axis, or NULL if axis is invalid.
QwtScaleEngine*QwtPlot::axisScaleEngine(intaxisId)Parameters:axisId Axis index
Returns:
Scale engine for a specific axis
constQwtScaleEngine*QwtPlot::axisScaleEngine(intaxisId)constParameters:axisId Axis index
Returns:
Scale engine for a specific axis
doubleQwtPlot::axisStepSize(intaxisId)const
Return the step size parameter that has been set in setAxisScale. This doesn't need to be the step size
of the current scale.
Parameters:axisId Axis index
Returns:
step size parameter value
Seealso:setAxisScale(), QwtScaleEngine::divideScale()QwtTextQwtPlot::axisTitle(intaxisId)constReturns:
Title of a specified axis
Parameters:axisId Axis index
boolQwtPlot::axisValid(intaxisId)[static],[protected]Returns:
true if the specified axis exists, otherwise false
Parameters:axisId axis index
constQwtScaleWidget*QwtPlot::axisWidget(intaxisId)constReturns:
Scale widget of the specified axis, or NULL if axisId is invalid.
Parameters:axisId Axis index
QwtScaleWidget*QwtPlot::axisWidget(intaxisId)Returns:
Scale widget of the specified axis, or NULL if axisId is invalid.
Parameters:axisId Axis index
QWidget*QwtPlot::canvas()Returns:
the plot's canvas
constQWidget*QwtPlot::canvas()constReturns:
the plot's canvas
QBrushQwtPlot::canvasBackground()const
Nothing else than: canvas()->palette().brush( QPalette::Normal, QPalette::Window);
Returns:
Background brush of the plotting area.
Seealso:setCanvasBackground()QwtScaleMapQwtPlot::canvasMap(intaxisId)const[virtual]Parameters:axisId Axis
Returns:
Map for the axis on the canvas. With this map pixel coordinates can translated to plot coordinates
and vice versa.
Seealso:QwtScaleMap, transform(), invTransform()voidQwtPlot::drawCanvas(QPainter*painter)[virtual]
Redraw the canvas.
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()Seealso:drawItems()voidQwtPlot::drawItems(QPainter*painter,constQRectF&canvasRect,constQwtScaleMapmaps[axisCnt])const[virtual]
Redraw the canvas items.
Parameters:painter Painter used for drawing
canvasRect Bounding rectangle where to paint
mapsQwtPlot::axisCnt 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()
voidQwtPlot::enableAxis(intaxisId,booltf=true)
Enable or disable a specified axis. When an axis is disabled, this only means that it is not visible on
the screen. Curves, markers and can be attached to disabled axes, and transformation of screen
coordinates into values works as normal.
Only xBottom and yLeft are enabled by default.
Parameters:axisId Axis index
tf true (enabled) or false (disabled)
boolQwtPlot::event(QEvent*event)[virtual]
Adds handling of layout requests.
Parameters:event Event
Returns:
See QFrame::event()
boolQwtPlot::eventFilter(QObject*object,QEvent*event)[virtual]
Event filter. 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()
Seealso:updateCanvasMargins(), updateLayout()QwtTextQwtPlot::footer()constReturns:
Text of the footer
QwtTextLabel*QwtPlot::footerLabel()Returns:
Footer label widget.
constQwtTextLabel*QwtPlot::footerLabel()constReturns:
Footer label widget.
voidQwtPlot::getCanvasMarginsHint(constQwtScaleMapmaps[],constQRectF&canvasRect,double&left,double&top,double&right,double&bottom)const[virtual]
Calculate the canvas margins.
Parameters:mapsQwtPlot::axisCnt 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.
updateCanvasMargins(), QwtPlotItem::getCanvasMarginHint()QStringQwtPlot::grabProperties()const
This method is intended for manipulating the plot widget from a specific editor in the Qwt designer
plugin.
Returns:
QString()
Warning:
The plot editor has never been implemented.
QwtPlotItem*QwtPlot::infoToItem(constQVariant&itemInfo)const[virtual]
Identify the plot item according to an item info object, that has bee 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.
Seealso:itemToInfo()voidQwtPlot::insertLegend(QwtAbstractLegend*legend,QwtPlot::LegendPositionpos=QwtPlot::RightLegend,doubleratio=-1.0)
Insert a legend. If the position legend is QwtPlot::LeftLegendorQwtPlot::RightLegendthelegendwillbeorganizedinonecolumnfromtoptodown.Otherwisethelegenditemswillbeplacedinatablewithabestfitnumberofcolumnsfromlefttoright.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.
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.
Seealso:legend(), QwtPlotLayout::legendPosition(), QwtPlotLayout::setLegendPosition()doubleQwtPlot::invTransform(intaxisId,intpos)const
Transform the x or y coordinate of a position in the drawing region into a value.
Parameters:axisId Axis index
pos position
Returns:
Position as axis coordinate
Warning:
The position can be an x or a y coordinate, depending on the specified axis.
voidQwtPlot::itemAttached(QwtPlotItem*plotItem,boolon)[signal]
A signal indicating, that an item has been attached/detached
Parameters:plotItem Plot item
on Attached/Detached
QVariantQwtPlot::itemToInfo(QwtPlotItem*plotItem)const[virtual]
Build 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.
QVariant itemInfo;
qVariantSetValue( itemInfo, plotItem );
Parameters:plotItem Plot item
Returns:
Plot item embedded in a QVariant
Seealso:infoToItem()QwtAbstractLegend*QwtPlot::legend()Returns:
the plot's legend
Seealso:insertLegend()constQwtAbstractLegend*QwtPlot::legend()constReturns:
the plot's legend
Seealso:insertLegend()voidQwtPlot::legendDataChanged(constQVariant&itemInfo,constQList<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.
Seealso:itemToInfo(), infoToItem(), QwtAbstractLegend::updateLegend()QwtPlotLayout*QwtPlot::plotLayout()Returns:
the plot's layout
constQwtPlotLayout*QwtPlot::plotLayout()constReturns:
the plot's layout
voidQwtPlot::replot()[virtual],[slot]
Redraw the plot. If the autoReplot option is not set (which is the default) or if any curves are attached
to raw data, the plot has to be refreshed explicitly in order to make changes visible.
Seealso:updateAxes(), setAutoReplot()voidQwtPlot::resizeEvent(QResizeEvent*e)[protected],[virtual]
Resize and update internal layout
Parameters:e Resize event
voidQwtPlot::setAutoReplot(booltf=true)
Set or reset the autoReplot option. If the autoReplot option is set, the plot will be updated implicitly
by manipulating member functions. Since this may be time-consuming, it is recommended to leave this
option switched off and call replot() explicitly if necessary.
The autoReplot option is set to false by default, which means that the user has to call replot() in order
to make changes visible.
Parameters:tf true or false. Defaults to true.
Seealso:replot()voidQwtPlot::setAxisAutoScale(intaxisId,boolon=true)
Enable autoscaling for a specified axis. This member function is used to switch back to autoscaling mode
after a fixed scale has been set. Autoscaling is enabled by default.
Parameters:axisId Axis index
on On/Off
Seealso:setAxisScale(), setAxisScaleDiv(), updateAxes()Note:
The autoscaling flag has no effect until updateAxes() is executed ( called by replot() ).
voidQwtPlot::setAxisFont(intaxisId,constQFont&font)
Change the font of an axis.
Parameters:axisId Axis index
font Font
Warning:
This function changes the font of the tick labels, not of the axis title.
voidQwtPlot::setAxisLabelAlignment(intaxisId,Qt::Alignmentalignment)
Change the alignment of the tick labels
Parameters:axisId Axis index
alignment Or'd Qt::AlignmentFlags see <qnamespace.h>
Seealso:QwtScaleDraw::setLabelAlignment()voidQwtPlot::setAxisLabelRotation(intaxisId,doublerotation)
Rotate all tick labels
Parameters:axisId Axis index
rotation Angle in degrees. When changing the label rotation, the label alignment might be adjusted
too.
Seealso:QwtScaleDraw::setLabelRotation(), setAxisLabelAlignment()voidQwtPlot::setAxisMaxMajor(intaxisId,intmaxMajor)
Set the maximum number of major scale intervals for a specified axis
Parameters:axisId Axis index
maxMajor Maximum number of major steps
Seealso:axisMaxMajor()voidQwtPlot::setAxisMaxMinor(intaxisId,intmaxMinor)
Set the maximum number of minor scale intervals for a specified axis
Parameters:axisId Axis index
maxMinor Maximum number of minor steps
Seealso:axisMaxMinor()voidQwtPlot::setAxisScale(intaxisId,doublemin,doublemax,doublestepSize=0)
Disable autoscaling and specify a fixed scale for a selected axis. In updateAxes() the scale engine
calculates a scale division from the specified parameters, that will be assigned to the scale widget. So
updates of the scale widget usually happen delayed with the next replot.
Parameters:axisId Axis index
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.
Seealso:setAxisMaxMajor(), setAxisAutoScale(), axisStepSize(), QwtScaleEngine::divideScale()voidQwtPlot::setAxisScaleDiv(intaxisId,constQwtScaleDiv&scaleDiv)
Disable autoscaling and specify a fixed scale for a selected axis. The scale division will be stored
locally only until the next call of updateAxes(). So updates of the scale widget usually happen delayed
with the next replot.
Parameters:axisId Axis index
scaleDiv Scale division
Seealso:setAxisScale(), setAxisAutoScale()voidQwtPlot::setAxisScaleDraw(intaxisId,QwtScaleDraw*scaleDraw)
Set a scale draw.
Parameters:axisId Axis index
scaleDraw Object responsible for drawing scales.
By passing scaleDraw it is possible to 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 ).
Seealso:QwtScaleDraw, QwtScaleWidgetWarning:
The attributes of scaleDraw will be overwritten by those of the previous QwtScaleDraw.
voidQwtPlot::setAxisScaleEngine(intaxisId,QwtScaleEngine*scaleEngine)
Change the scale engine for an axis
Parameters:axisId Axis index
scaleEngine Scale engine
Seealso:axisScaleEngine()voidQwtPlot::setAxisTitle(intaxisId,constQString&title)
Change the title of a specified axis.
Parameters:axisId Axis index
title axis title
voidQwtPlot::setAxisTitle(intaxisId,constQwtText&title)
Change the title of a specified axis.
Parameters:axisId Axis index
title Axis title
voidQwtPlot::setCanvas(QWidget*canvas)
Set the drawing canvas of the plot widget. QwtPlot invokes methods of the canvas as meta methods ( see
QMetaObject ). In opposite to using conventional C++ techniques like virtual methods they allow to use
canvas implementations that are derived from QWidget or QGLWidget.
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 QwtPlotCanvasParameters:canvas Canvas Widget
Seealso:canvas()voidQwtPlot::setCanvasBackground(constQBrush&brush)
Change the background of the plotting area. 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.
Parameters:brush New background brush
Seealso:canvasBackground()voidQwtPlot::setFooter(constQString&text)
Change the text the footer
Parameters:text New text of the footer
voidQwtPlot::setFooter(constQwtText&text)
Change the text the footer
Parameters:text New text of the footer
voidQwtPlot::setPlotLayout(QwtPlotLayout*layout)
Assign a new plot layout.
Parameters:layout Layout()
Seealso:plotLayout()voidQwtPlot::setTitle(constQString&title)
Change the plot's title
Parameters:title New title
voidQwtPlot::setTitle(constQwtText&title)
Change the plot's title
Parameters:title New title
QSizeQwtPlot::sizeHint()const[virtual]Returns:
Size hint for the plot widget
Seealso:minimumSizeHint()QwtTextQwtPlot::title()constReturns:
Title of the plot
QwtTextLabel*QwtPlot::titleLabel()Returns:
Title label widget.
constQwtTextLabel*QwtPlot::titleLabel()constReturns:
Title label widget.
doubleQwtPlot::transform(intaxisId,doublevalue)const
Transform a value into a coordinate in the plotting region.
Parameters:axisId Axis index
value value
Returns:
X or Y coordinate in the plotting region corresponding to the value.
voidQwtPlot::updateAxes()
Rebuild the axes scales. 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 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().
Seealso:setAxisAutoScale(), setAxisScale(), setAxisScaleDiv(), replot()QwtPlotItem::boundingRect()voidQwtPlot::updateCanvasMargins()
Update the canvas margins. Plot items might indicate, that they need some extra space at the borders of
the canvas by the QwtPlotItem::Margins flag.
getCanvasMarginsHint(), QwtPlotItem::getCanvasMarginHint()voidQwtPlot::updateLayout()[virtual]
Adjust plot content to its current size.
Seealso:resizeEvent()voidQwtPlot::updateLegend()
Emit legendDataChanged() for all plot item
Seealso:QwtPlotItem::legendData(), legendDataChanged()voidQwtPlot::updateLegend(constQwtPlotItem*plotItem)
Emit legendDataChanged() for a plot item
Parameters:plotItem Plot item
Seealso:QwtPlotItem::legendData(), legendDataChanged()