QwtPlotRescaler takes care of fixed aspect ratios for plot scales. More...
#include <qwt_plot_rescaler.h>
Classes | |
| class | AxisData |
| class | PrivateData |
Public Types | |
| enum | ExpandingDirection { ExpandUp, ExpandDown, ExpandBoth } |
| enum | RescalePolicy { Fixed, Expanding, Fitting } |
Public Member Functions | |
| double | aspectRatio (int axis) const |
| QWidget * | canvas () |
| const QWidget * | canvas () const |
| virtual bool | eventFilter (QObject *, QEvent *) |
| Event filter for the plot canvas. | |
| ExpandingDirection | expandingDirection (int axis) const |
| QwtInterval | intervalHint (int axis) const |
| bool | isEnabled () const |
| QwtPlot * | plot () |
| const QwtPlot * | plot () const |
| QwtPlotRescaler (QWidget *canvas, int referenceAxis=QwtPlot::xBottom, RescalePolicy=Expanding) | |
| int | referenceAxis () const |
| void | rescale () const |
| Adjust the plot axes scales. | |
| RescalePolicy | rescalePolicy () const |
| void | setAspectRatio (double ratio) |
| void | setAspectRatio (int axis, double ratio) |
| void | setEnabled (bool) |
| En/disable the rescaler. | |
| void | setExpandingDirection (ExpandingDirection) |
| void | setExpandingDirection (int axis, ExpandingDirection) |
| void | setIntervalHint (int axis, const QwtInterval &) |
| void | setReferenceAxis (int axis) |
| void | setRescalePolicy (RescalePolicy) |
| virtual | ~QwtPlotRescaler () |
| Destructor. | |
Protected Member Functions | |
| virtual void | canvasResizeEvent (QResizeEvent *) |
| QwtInterval | expandInterval (const QwtInterval &, double width, ExpandingDirection) const |
| virtual QwtInterval | expandScale (int axis, const QSize &oldSize, const QSize &newSize) const |
| QwtInterval | interval (int axis) const |
| Qt::Orientation | orientation (int axis) const |
| virtual void | rescale (const QSize &oldSize, const QSize &newSize) const |
| virtual QwtInterval | syncScale (int axis, const QwtInterval &reference, const QSize &size) const |
| virtual void | updateScales (QwtInterval intervals[QwtPlot::axisCnt]) const |
Private Member Functions | |
| double | pixelDist (int axis, const QSize &) const |
Private Attributes | |
| PrivateData * | d_data |
QwtPlotRescaler takes care of fixed aspect ratios for plot scales.
QwtPlotRescaler auto adjusts the axes of a QwtPlot according to fixed aspect ratios.
Definition at line 28 of file qwt_plot_rescaler.h.
When rescalePolicy() is set to Expanding its direction depends on ExpandingDirection
| ExpandUp |
The upper limit of the scale is adjusted. |
| ExpandDown |
The lower limit of the scale is adjusted. |
| ExpandBoth |
Both limits of the scale are adjusted. |
Definition at line 67 of file qwt_plot_rescaler.h.
The rescale policy defines how to rescale the reference axis and their depending axes.
Definition at line 37 of file qwt_plot_rescaler.h.
| QwtPlotRescaler::QwtPlotRescaler | ( | QWidget * | canvas, |
| int | referenceAxis = QwtPlot::xBottom, |
||
| RescalePolicy | policy = Expanding |
||
| ) | [explicit] |
Constructor
| canvas | Canvas |
| referenceAxis | Reference axis, see RescalePolicy |
| policy | Rescale policy |
Definition at line 61 of file qwt_plot_rescaler.cpp.
| QwtPlotRescaler::~QwtPlotRescaler | ( | ) | [virtual] |
Destructor.
Definition at line 73 of file qwt_plot_rescaler.cpp.
| double QwtPlotRescaler::aspectRatio | ( | int | axis | ) | const |
| axis | Axis index ( see QwtPlot::AxisId ) |
Definition at line 231 of file qwt_plot_rescaler.cpp.
| QWidget * QwtPlotRescaler::canvas | ( | ) |
Definition at line 270 of file qwt_plot_rescaler.cpp.
| const QWidget * QwtPlotRescaler::canvas | ( | ) | const |
Definition at line 276 of file qwt_plot_rescaler.cpp.
| void QwtPlotRescaler::canvasResizeEvent | ( | QResizeEvent * | event | ) | [protected, virtual] |
Event handler for resize events of the plot canvas
| event | Resize event |
Definition at line 331 of file qwt_plot_rescaler.cpp.
| bool QwtPlotRescaler::eventFilter | ( | QObject * | object, |
| QEvent * | event | ||
| ) | [virtual] |
Event filter for the plot canvas.
Definition at line 302 of file qwt_plot_rescaler.cpp.
| QwtPlotRescaler::ExpandingDirection QwtPlotRescaler::expandingDirection | ( | int | axis | ) | const |
| axis | Axis index ( see QwtPlot::AxisId ) |
Definition at line 187 of file qwt_plot_rescaler.cpp.
| QwtInterval QwtPlotRescaler::expandInterval | ( | const QwtInterval & | interval, |
| double | width, | ||
| ExpandingDirection | direction | ||
| ) | const [protected] |
Expand the interval
| interval | Interval to be expanded |
| width | Distance to be added to the interval |
| direction | Direction of the expand operation |
Definition at line 511 of file qwt_plot_rescaler.cpp.
| QwtInterval QwtPlotRescaler::expandScale | ( | int | axis, |
| const QSize & | oldSize, | ||
| const QSize & | newSize | ||
| ) | const [protected, virtual] |
Calculate the new scale interval of a plot axis
| axis | Axis index ( see QwtPlot::AxisId ) |
| oldSize | Previous size of the canvas |
| newSize | New size of the canvas |
Definition at line 388 of file qwt_plot_rescaler.cpp.
| QwtInterval QwtPlotRescaler::interval | ( | int | axis | ) | const [protected] |
| axis | Axis index ( see QwtPlot::AxisId ) |
Definition at line 494 of file qwt_plot_rescaler.cpp.
| QwtInterval QwtPlotRescaler::intervalHint | ( | int | axis | ) | const |
| axis | Axis, see QwtPlot::Axis |
Definition at line 261 of file qwt_plot_rescaler.cpp.
| bool QwtPlotRescaler::isEnabled | ( | ) | const |
Definition at line 108 of file qwt_plot_rescaler.cpp.
| Qt::Orientation QwtPlotRescaler::orientation | ( | int | axis | ) | const [protected] |
| axis | Axis index ( see QwtPlot::AxisId ) |
Definition at line 482 of file qwt_plot_rescaler.cpp.
| double QwtPlotRescaler::pixelDist | ( | int | axis, |
| const QSize & | size | ||
| ) | const [private] |
Definition at line 538 of file qwt_plot_rescaler.cpp.
| QwtPlot * QwtPlotRescaler::plot | ( | ) |
Definition at line 282 of file qwt_plot_rescaler.cpp.
| const QwtPlot * QwtPlotRescaler::plot | ( | ) | const |
Definition at line 292 of file qwt_plot_rescaler.cpp.
| int QwtPlotRescaler::referenceAxis | ( | ) | const |
Definition at line 148 of file qwt_plot_rescaler.cpp.
| void QwtPlotRescaler::rescale | ( | ) | const |
Adjust the plot axes scales.
Definition at line 345 of file qwt_plot_rescaler.cpp.
| void QwtPlotRescaler::rescale | ( | const QSize & | oldSize, |
| const QSize & | newSize | ||
| ) | const [protected, virtual] |
Adjust the plot axes scales
| oldSize | Previous size of the canvas |
| newSize | New size of the canvas |
Definition at line 357 of file qwt_plot_rescaler.cpp.
Definition at line 128 of file qwt_plot_rescaler.cpp.
| void QwtPlotRescaler::setAspectRatio | ( | double | ratio | ) |
Set the aspect ratio between the scale of the reference axis and the other scales. The default ratio is 1.0
| ratio | Aspect ratio |
Definition at line 202 of file qwt_plot_rescaler.cpp.
| void QwtPlotRescaler::setAspectRatio | ( | int | axis, |
| double | ratio | ||
| ) |
Set the aspect ratio between the scale of the reference axis and another scale. The default ratio is 1.0
| axis | Axis index ( see QwtPlot::AxisId ) |
| ratio | Aspect ratio |
Definition at line 216 of file qwt_plot_rescaler.cpp.
| void QwtPlotRescaler::setEnabled | ( | bool | on | ) |
En/disable the rescaler.
When enabled is true an event filter is installed for the canvas, otherwise the event filter is removed.
| on | true or false |
Definition at line 87 of file qwt_plot_rescaler.cpp.
| void QwtPlotRescaler::setExpandingDirection | ( | ExpandingDirection | direction | ) |
Set the direction in which all axis should be expanded
| direction | Direction |
Definition at line 159 of file qwt_plot_rescaler.cpp.
| void QwtPlotRescaler::setExpandingDirection | ( | int | axis, |
| ExpandingDirection | direction | ||
| ) |
Set the direction in which an axis should be expanded
| axis | Axis index ( see QwtPlot::AxisId ) |
| direction | Direction |
Definition at line 173 of file qwt_plot_rescaler.cpp.
| void QwtPlotRescaler::setIntervalHint | ( | int | axis, |
| const QwtInterval & | interval | ||
| ) |
Set an interval hint for an axis
In Fitting mode, the hint is used as minimal interval that always needs to be displayed.
| axis | Axis, see QwtPlot::Axis |
| interval | Axis |
Definition at line 249 of file qwt_plot_rescaler.cpp.
| void QwtPlotRescaler::setReferenceAxis | ( | int | axis | ) |
Set the reference axis ( see RescalePolicy )
| axis | Axis index ( QwtPlot::Axis ) |
Definition at line 139 of file qwt_plot_rescaler.cpp.
| void QwtPlotRescaler::setRescalePolicy | ( | RescalePolicy | policy | ) |
Change the rescale policy
| policy | Rescale policy |
Definition at line 119 of file qwt_plot_rescaler.cpp.
| QwtInterval QwtPlotRescaler::syncScale | ( | int | axis, |
| const QwtInterval & | reference, | ||
| const QSize & | size | ||
| ) | const [protected, virtual] |
Synchronize an axis scale according to the scale of the reference axis
| axis | Axis index ( see QwtPlot::AxisId ) |
| reference | Interval of the reference axis |
| size | Size of the canvas |
Definition at line 451 of file qwt_plot_rescaler.cpp.
| void QwtPlotRescaler::updateScales | ( | QwtInterval | intervals[QwtPlot::axisCnt] | ) | const [protected, virtual] |
Update the axes scales
| intervals | Scale intervals |
Definition at line 571 of file qwt_plot_rescaler.cpp.
PrivateData* QwtPlotRescaler::d_data [private] |
Definition at line 138 of file qwt_plot_rescaler.h.