|
QWT API (English) 7.3.0
Qt Widget Library for Technical Applications - English API Documentation
|
A plotting widget, displaying a polar coordinate system. More...
#include <qwt_polar_plot.h>
Classes | |
| class | PrivateData |
Public Types | |
| enum | LegendPosition { LeftLegend , RightLegend , BottomLegend , TopLegend , ExternalLegend } |
| Position of the legend, relative to the canvas. More... | |
Public Slots | |
| virtual void | replot () |
| Replot the plot. | |
| void | autoRefresh () |
| Auto refresh the plot. | |
| void | setAzimuthOrigin (double) |
| Set the azimuth origin. | |
Signals | |
| void | itemAttached (QwtPolarItem *plotItem, bool on) |
| A signal indicating, that an item has been attached/detached. | |
| void | legendDataChanged (const QVariant &itemInfo, const QList< QwtLegendData > &data) |
| A signal with the attributes how to update the legend entries for a plot item. | |
| void | layoutChanged () |
| A signal that is emitted, whenever the layout of the plot has been recalculated. | |
Public Member Functions | |
| QwtPolarPlot (QWidget *parent=nullptr) | |
| Constructor. | |
| QwtPolarPlot (const QwtText &title, QWidget *parent=nullptr) | |
| Constructor with title. | |
| ~QwtPolarPlot () override | |
| Destructor. | |
| void | setTitle (const QString &) |
| Set the title. | |
| void | setTitle (const QwtText &) |
| Set the title. | |
| QwtText | title () const |
| Get the title. | |
| QwtTextLabel * | titleLabel () |
| Get the title label. | |
| const QwtTextLabel * | titleLabel () const |
| Get the title label (const version) | |
| void | setAutoReplot (bool tf=true) |
| Set auto replot. | |
| bool | autoReplot () const |
| Get auto replot. | |
| void | setAutoScale (int scaleId) |
| Set auto scale for a scale. | |
| bool | hasAutoScale (int scaleId) const |
| Check if a scale has auto scale. | |
| void | setScaleMaxMinor (int scaleId, int maxMinor) |
| Set the maximum number of minor ticks for a scale. | |
| int | scaleMaxMinor (int scaleId) const |
| Get the maximum number of minor ticks for a scale. | |
| int | scaleMaxMajor (int scaleId) const |
| Get the maximum number of major ticks for a scale. | |
| void | setScaleMaxMajor (int scaleId, int maxMajor) |
| Set the maximum number of major ticks for a scale. | |
| QwtScaleEngine * | scaleEngine (int scaleId) |
| Get the scale engine for a scale. | |
| const QwtScaleEngine * | scaleEngine (int scaleId) const |
| Get the scale engine for a scale (const version) | |
| void | setScaleEngine (int scaleId, QwtScaleEngine *) |
| Set the scale engine for a scale. | |
| void | setScale (int scaleId, double min, double max, double step=0) |
| Set the scale for a scale. | |
| void | setScaleDiv (int scaleId, const QwtScaleDiv &) |
| Set the scale division for a scale. | |
| const QwtScaleDiv * | scaleDiv (int scaleId) const |
| Get the scale division for a scale (const version) | |
| QwtScaleDiv * | scaleDiv (int scaleId) |
| Get the scale division for a scale. | |
| QwtScaleMap | scaleMap (int scaleId, double radius) const |
| Get the scale map for a scale with radius. | |
| QwtScaleMap | scaleMap (int scaleId) const |
| Get the scale map for a scale. | |
| void | updateScale (int scaleId) |
| Update a scale. | |
| double | azimuthOrigin () const |
| Get the azimuth origin. | |
| void | zoom (const QwtPointPolar &, double factor) |
| Zoom to a position with a factor. | |
| void | unzoom () |
| Unzoom the plot. | |
| QwtPointPolar | zoomPos () const |
| Get the zoom position. | |
| double | zoomFactor () const |
| Get the zoom factor. | |
| QwtPolarCanvas * | canvas () |
| Get the canvas. | |
| const QwtPolarCanvas * | canvas () const |
| Get the canvas (const version) | |
| void | setPlotBackground (const QBrush &c) |
| Set the plot background. | |
| const QBrush & | plotBackground () const |
| Get the plot background. | |
| void | setBackgroundColor (const QColor &c) |
| Set the background color. | |
| QColor | backgroundColor () const |
| Get the background color. | |
| virtual void | drawCanvas (QPainter *, const QRectF &) const |
| Draw the canvas. | |
| void | insertLegend (QwtAbstractLegend *, LegendPosition=RightLegend, double ratio=-1.0) |
| Insert a legend. | |
| QwtAbstractLegend * | legend () |
| Get the legend. | |
| const QwtAbstractLegend * | legend () const |
| Get the legend (const version) | |
| void | updateLegend () |
| Update the legend. | |
| void | updateLegend (const QwtPolarItem *) |
| Update the legend for an item. | |
| QwtPolarLayout * | plotLayout () |
| Get the plot layout. | |
| const QwtPolarLayout * | plotLayout () const |
| Get the plot layout (const version) | |
| QwtInterval | visibleInterval () const |
| Get the visible interval. | |
| QRectF | plotRect () const |
| Get the plot rectangle. | |
| QRectF | plotRect (const QRectF &) const |
| Get the plot rectangle for a given rectangle. | |
| int | plotMarginHint () const |
| Get the plot margin hint. | |
| virtual QVariant | itemToInfo (QwtPolarItem *) const |
| Convert an item to info. | |
| virtual QwtPolarItem * | infoToItem (const QVariant &) const |
| Convert info to an item. | |
Public Member Functions inherited from QwtPolarItemDict | |
| QwtPolarItemDict () | |
| Constructor. | |
| ~QwtPolarItemDict () | |
| Destructor. | |
| void | setAutoDelete (bool) |
| Set auto delete. | |
| bool | autoDelete () const |
| Get auto delete. | |
| const QwtPolarItemList & | itemList () const |
| Get the item list. | |
| void | detachItems (int rtti=QwtPolarItem::Rtti_PolarItem, bool autoDelete=true) |
| Detach items. | |
Protected Member Functions | |
| virtual bool | event (QEvent *) override |
| Handle events. | |
| virtual void | resizeEvent (QResizeEvent *) override |
| Handle resize events. | |
| virtual void | updateLayout () |
| Update the layout. | |
| virtual void | drawItems (QPainter *painter, const QwtScaleMap &radialMap, const QwtScaleMap &azimuthMap, const QPointF &pole, double radius, const QRectF &canvasRect) const |
| Draw items. | |
Protected Member Functions inherited from QwtPolarItemDict | |
| void | insertItem (QwtPolarItem *) |
| Insert an item. | |
| void | removeItem (QwtPolarItem *) |
| Remove an item. | |
Properties | |
| QBrush | plotBackground |
| double | azimuthOrigin |
Friends | |
| class | QwtPolarItem |
A plotting widget, displaying a polar coordinate system.
An unlimited number of plot items can be displayed on its canvas. Plot items might be curves (QwtPolarCurve), markers (QwtPolarMarker), the grid (QwtPolarGrid), or anything else derived from QwtPolarItem.
The coordinate system is defined by a radial and a azimuth scale. The scales at the axes can be explicitly set (QwtScaleDiv), or are calculated from the plot items, using algorithms (QwtScaleEngine) which can be configured separately for each axis. Autoscaling is supported for the radial scale.
In opposite to QwtPlot the scales might be different from the view, that is displayed on the canvas. The view can be changed by zooming - f.e. by using QwtPolarPanner or QwtPolarMaginfier.
Position of the legend, relative to the canvas.
| Enumerator | |
|---|---|
| LeftLegend | The legend will be left from the canvas. |
| RightLegend | The legend will be right from the canvas. |
| BottomLegend | The legend will be below the canvas. |
| TopLegend | The legend will be between canvas and title. |
| ExternalLegend | External means that only the content of the legend will be handled by QwtPlot, but not its geometry. This might be interesting if an application wants to have a legend in an external window ( or on the canvas ).
|
|
explicit |
Constructor.
| parent | Parent widget |
| QwtPolarPlot::QwtPolarPlot | ( | const QwtText & | title, |
| QWidget * | parent = nullptr |
||
| ) |
Constructor with title.
| title | Title text |
| parent | Parent widget |
|
slot |
Auto refresh the plot.
Replots the plot if autoReplot() is true.
| bool QwtPolarPlot::autoReplot | ( | ) | const |
Get auto replot.
Check if autoReplot option is set.
true if autoReplot option is set | double QwtPolarPlot::azimuthOrigin | ( | ) | const |
Get the azimuth origin.
Get the origin of the azimuth scale.
The azimuth origin is the angle where the azimuth scale shows the value 0.0.
| QColor QwtPolarPlot::backgroundColor | ( | ) | const |
| QwtPolarCanvas * QwtPolarPlot::canvas | ( | ) |
Get the canvas.
Get the plot's canvas.
| const QwtPolarCanvas * QwtPolarPlot::canvas | ( | ) | const |
Get the canvas (const version)
Get the plot's canvas (const version)
|
virtual |
Draw the canvas.
Redraw the canvas.
| painter | Painter used for drawing |
| canvasRect | Contents rect of the canvas |
|
protectedvirtual |
Draw items.
Redraw the canvas items.
| painter | Painter used for drawing |
| azimuthMap | Maps azimuth values to values related to 0.0, M_2PI |
| radialMap | Maps radius values into painter coordinates |
| pole | Position of the pole in painter coordinates |
| radius | Radius of the complete plot area in painter coordinates |
| canvasRect | Contents rect of the canvas in painter coordinates |
|
overrideprotectedvirtual |
Handle events.
Qt event handler.
Handles QEvent::LayoutRequest and QEvent::PolishRequest
| e | Qt Event |
| bool QwtPolarPlot::hasAutoScale | ( | int | scaleId | ) | const |
Check if a scale has auto scale.
Check if autoscaling is enabled.
| scaleId | Scale index |
true if autoscaling is enabled
|
virtual |
Convert info to an item.
Identify the plot item according to an item info object.
The default implementation simply tries to unwrap a QwtPolarItem pointer.
| itemInfo | Item info object generated from itemToInfo() |
| void QwtPolarPlot::insertLegend | ( | QwtAbstractLegend * | legend, |
| QwtPolarPlot::LegendPosition | pos = RightLegend, |
||
| double | ratio = -1.0 |
||
| ) |
Insert a legend.
If the position legend is QwtPolarPlot::LeftLegend or QwtPolarPlot::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. If pos != QwtPolarPlot::ExternalLegend the plot widget will become parent of the legend. It will be deleted when the plot is deleted, or another legend is set with insertLegend().
| legend | Legend widget |
| 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 rect 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. |
|
signal |
A signal indicating, that an item has been attached/detached.
| plotItem | Plot item |
| on | Attached/Detached |
|
virtual |
Convert an item to info.
Build an information object 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 be reimplemented too.
| plotItem | Plot item |
| QwtAbstractLegend * QwtPolarPlot::legend | ( | ) |
| const QwtAbstractLegend * QwtPolarPlot::legend | ( | ) | const |
Get the legend (const version)
Get the plot's legend (const version)
|
signal |
A signal with the attributes how to update the legend entries for a plot item.
| itemInfo | Info about a plot, build from itemToInfo() |
| data | Attributes of the entries ( usually <= 1 ) for the plot item |
| const QBrush & QwtPolarPlot::plotBackground | ( | ) | const |
Get the plot background.
Get the plot background brush.
| QwtPolarLayout * QwtPolarPlot::plotLayout | ( | ) |
Get the plot layout.
Get the layout responsible for geometry of plot components.
| const QwtPolarLayout * QwtPolarPlot::plotLayout | ( | ) | const |
Get the plot layout (const version)
Get the layout responsible for geometry of plot components (const version)
| int QwtPolarPlot::plotMarginHint | ( | ) | const |
Get the plot margin hint.
Get the maximum of all item margin hints.
| QRectF QwtPolarPlot::plotRect | ( | ) | const |
Get the plot rectangle.
Get the bounding rect of the plot area.
The plot area depends on the size of the canvas and the zoom parameters.
| QRectF QwtPolarPlot::plotRect | ( | const QRectF & | canvasRect | ) | const |
Get the plot rectangle for a given rectangle.
Calculate the bounding rect of the plot area.
The plot area depends on the zoom parameters.
| canvasRect | Rectangle of the canvas |
|
virtualslot |
Replot the plot.
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.
|
overrideprotectedvirtual |
Handle resize events.
Resize and update internal layout.
| e | Resize event |
| QwtScaleDiv * QwtPolarPlot::scaleDiv | ( | int | scaleId | ) |
Get the scale division for a scale.
Return the scale division of a specified scale.
scaleDiv(scaleId)->lBound(), scaleDiv(scaleId)->hBound() are the current limits of the scale.
| scaleId | Scale index |
| const QwtScaleDiv * QwtPolarPlot::scaleDiv | ( | int | scaleId | ) | const |
Get the scale division for a scale (const version)
Return the scale division of a specified scale.
scaleDiv(scaleId)->lBound(), scaleDiv(scaleId)->hBound() are the current limits of the scale.
| scaleId | Scale index |
| QwtScaleEngine * QwtPolarPlot::scaleEngine | ( | int | scaleId | ) |
Get the scale engine for a scale.
Get scale engine for a specific scale.
| scaleId | Scale index |
| const QwtScaleEngine * QwtPolarPlot::scaleEngine | ( | int | scaleId | ) | const |
Get the scale engine for a scale (const version)
Get scale engine for a specific scale (const version)
| scaleId | Scale index |
| QwtScaleMap QwtPolarPlot::scaleMap | ( | int | scaleId | ) | const |
Get the scale map for a scale.
Build a scale map.
The azimuth map translates between the scale values and angles from [0.0, 2 * PI[. The radial map translates scale values into the distance from the pole. The radial map is calculated from the current geometry of the canvas.
| scaleId | Scale index |
| QwtScaleMap QwtPolarPlot::scaleMap | ( | int | scaleId, |
| double | radius | ||
| ) | const |
Get the scale map for a scale with radius.
Build a scale map with specified radius.
The azimuth map translates between the scale values and angles from [0.0, 2 * PI[. The radial map translates scale values into the distance from the pole.
| scaleId | Scale index |
| radius | Radius of the plot area in pixels |
| int QwtPolarPlot::scaleMaxMajor | ( | int | scaleId | ) | const |
Get the maximum number of major ticks for a scale.
Get the maximum number of major ticks for a specified axis.
| scaleId | Scale index |
| int QwtPolarPlot::scaleMaxMinor | ( | int | scaleId | ) | const |
Get the maximum number of minor ticks for a scale.
Get the maximum number of minor ticks for a specified axis.
| scaleId | Scale index |
| void QwtPolarPlot::setAutoReplot | ( | bool | enable = true | ) |
Set auto replot.
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.
| enable | true or false. Defaults to true. |
| void QwtPolarPlot::setAutoScale | ( | int | scaleId | ) |
Set auto scale for a scale.
Enable autoscaling.
This member function is used to switch back to autoscaling mode after a fixed scale has been set. Autoscaling calculates a useful scale division from the bounding interval of all plot items with the QwtPolarItem::AutoScale attribute. Autoscaling is only supported for the radial scale and enabled as default.
| scaleId | Scale index |
|
slot |
Set the azimuth origin.
Change the origin of the azimuth scale.
The azimuth origin is the angle where the azimuth scale shows the value 0.0. The default origin is 0.0.
| origin | New origin |
| void QwtPolarPlot::setBackgroundColor | ( | const QColor & | c | ) |
| void QwtPolarPlot::setPlotBackground | ( | const QBrush & | brush | ) |
Set the plot background.
Set the background of the plot area.
The plot area is the circle around the pole. Its radius is defined by the radial scale.
| brush | Background brush |
| void QwtPolarPlot::setScale | ( | int | scaleId, |
| double | min, | ||
| double | max, | ||
| double | stepSize = 0 |
||
| ) |
Set the scale for a scale.
Disable autoscaling and specify a fixed scale for a selected scale.
| scaleId | Scale index |
| min | Minimum value of the scale |
| max | Maximum value of the scale |
| stepSize | Major step size. If step == 0, the step size is calculated automatically using the maxMajor setting. |
| void QwtPolarPlot::setScaleDiv | ( | int | scaleId, |
| const QwtScaleDiv & | scaleDiv | ||
| ) |
Set the scale division for a scale.
Disable autoscaling and specify a fixed scale for a selected scale.
| scaleId | Scale index |
| scaleDiv | Scale division |
| void QwtPolarPlot::setScaleEngine | ( | int | scaleId, |
| QwtScaleEngine * | scaleEngine | ||
| ) |
Set the scale engine for a scale.
Change the scale engine for an axis.
| scaleId | Scale index |
| scaleEngine | Scale engine |
| void QwtPolarPlot::setScaleMaxMajor | ( | int | scaleId, |
| int | maxMajor | ||
| ) |
Set the maximum number of major ticks for a scale.
Set the maximum number of major scale intervals for a specified scale.
| scaleId | Scale index |
| maxMajor | Maximum number of major steps |
| void QwtPolarPlot::setScaleMaxMinor | ( | int | scaleId, |
| int | maxMinor | ||
| ) |
Set the maximum number of minor ticks for a scale.
Set the maximum number of minor scale intervals for a specified scale.
| scaleId | Scale index |
| maxMinor | Maximum number of minor steps |
| void QwtPolarPlot::setTitle | ( | const QString & | title | ) |
Set the title.
Change the plot's title.
| title | New title |
| void QwtPolarPlot::setTitle | ( | const QwtText & | title | ) |
Set the title.
Change the plot's title.
| title | New title |
| QwtText QwtPolarPlot::title | ( | ) | const |
Get the title.
Get the plot's title.
| QwtTextLabel * QwtPolarPlot::titleLabel | ( | ) |
Get the title label.
Get the title label widget.
| const QwtTextLabel * QwtPolarPlot::titleLabel | ( | ) | const |
Get the title label (const version)
Get the title label widget (const version)
| void QwtPolarPlot::unzoom | ( | ) |
Unzoom the plot.
|
protectedvirtual |
Update the layout.
Rebuild the layout.
| void QwtPolarPlot::updateLegend | ( | ) |
Update the legend.
Emit legendDataChanged() for all plot items.
| void QwtPolarPlot::updateLegend | ( | const QwtPolarItem * | plotItem | ) |
Update the legend for an item.
Emit legendDataChanged() for a plot item.
| plotItem | Plot item |
| void QwtPolarPlot::updateScale | ( | int | scaleId | ) |
Update a scale.
Rebuild the scale.
| scaleId | Scale index |
| QwtInterval QwtPolarPlot::visibleInterval | ( | ) | const |
Get the visible interval.
Get the bounding interval of the radial scale visible on canvas.
| void QwtPolarPlot::zoom | ( | const QwtPointPolar & | zoomPos, |
| double | zoomFactor | ||
| ) |
Zoom to a position with a factor.
Translate and in/decrease the zoom factor.
In zoom mode the zoom position is in the center of the canvas. The radius of the circle depends on the size of the plot canvas, that is divided by the zoom factor. Thus a factor < 1.0 zooms in. Setting an invalid zoom position disables zooming.
| zoomPos | Center of the translation |
| zoomFactor | Zoom factor |
| double QwtPolarPlot::zoomFactor | ( | ) | const |
| QwtPointPolar QwtPolarPlot::zoomPos | ( | ) | const |