QwtPlotRescaler(3) | Qwt User's Guide | QwtPlotRescaler(3) |
NAME
QwtPlotRescaler - QwtPlotRescaler takes care of fixed aspect ratios for plot scales.
SYNOPSIS
#include <qwt_plot_rescaler.h>
Inherits QObject.
Public Types
enum RescalePolicy { Fixed, Expanding,
Fitting }
enum ExpandingDirection { ExpandUp, ExpandDown,
ExpandBoth }
Public Member Functions
QwtPlotRescaler (QWidget *canvas, QwtAxisId
referenceAxis=QwtAxis::XBottom,
RescalePolicy=Expanding)
virtual ~QwtPlotRescaler ()
Destructor. void setEnabled (bool)
En/disable the rescaler. bool isEnabled () const
void setRescalePolicy (RescalePolicy)
RescalePolicy rescalePolicy () const
void setExpandingDirection (ExpandingDirection)
void setExpandingDirection (QwtAxisId, ExpandingDirection)
ExpandingDirection expandingDirection (QwtAxisId) const
void setReferenceAxis (QwtAxisId)
QwtAxisId referenceAxis () const
void setAspectRatio (double ratio)
void setAspectRatio (QwtAxisId, double ratio)
double aspectRatio (QwtAxisId) const
void setIntervalHint (QwtAxisId, const QwtInterval &)
QwtInterval intervalHint (QwtAxisId) const
QWidget * canvas ()
const QWidget * canvas () const
QwtPlot * plot ()
const QwtPlot * plot () const
virtual bool eventFilter (QObject *, QEvent *) override
Event filter for the plot canvas. void rescale () const
Adjust the plot axes scales.
Protected Member Functions
virtual void canvasResizeEvent (QResizeEvent *)
virtual void rescale (const QSize &oldSize, const QSize
&newSize) const
virtual QwtInterval expandScale (QwtAxisId, const QSize
&oldSize, const QSize &newSize) const
virtual QwtInterval syncScale (QwtAxisId, const
QwtInterval &reference, const QSize &size) const
virtual void updateScales (QwtInterval
intervals[QwtAxis::AxisPositions]) const
Qt::Orientation orientation (QwtAxisId) const
QwtInterval interval (QwtAxisId) const
QwtInterval expandInterval (const QwtInterval &,
double width, ExpandingDirection) const
Detailed Description
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 29 of file qwt_plot_rescaler.h.
Member Enumeration Documentation
enum QwtPlotRescaler::ExpandingDirection
When rescalePolicy() is set to Expanding its direction depends on ExpandingDirection
Enumerator
- 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 70 of file qwt_plot_rescaler.h.
enum QwtPlotRescaler::RescalePolicy
The rescale policy defines how to rescale the reference axis and their depending axes.
See also
Enumerator
- Fixed
- The interval of the reference axis remains unchanged, when the geometry of the canvas changes. All other axes will be adjusted according to their aspect ratio.
- Expanding
- The interval of the reference axis will be shrunk/expanded, when the geometry of the canvas changes. All other axes will be adjusted according to their aspect ratio.
The interval, that is represented by one pixel is fixed.
- Fitting
- The intervals of the axes are calculated, so that all axes include their interval hint.
Definition at line 40 of file qwt_plot_rescaler.h.
Constructor & Destructor Documentation
QwtPlotRescaler::QwtPlotRescaler (QWidget * canvas, QwtAxisId referenceAxis = QwtAxis::XBottom, RescalePolicy policy = Expanding) [explicit]
Constructor
Parameters
referenceAxis Reference axis, see RescalePolicy
policy Rescale policy
See also
Definition at line 71 of file qwt_plot_rescaler.cpp.
Member Function Documentation
double QwtPlotRescaler::aspectRatio (QwtAxisId axisId) const
Returns
Parameters
See also
Definition at line 243 of file qwt_plot_rescaler.cpp.
QWidget * QwtPlotRescaler::canvas ()
Returns
Definition at line 282 of file qwt_plot_rescaler.cpp.
const QWidget * QwtPlotRescaler::canvas () const
Returns
Definition at line 288 of file qwt_plot_rescaler.cpp.
void QwtPlotRescaler::canvasResizeEvent (QResizeEvent * event) [protected], [virtual]
Event handler for resize events of the plot canvas
Parameters
See also
Definition at line 343 of file qwt_plot_rescaler.cpp.
QwtPlotRescaler::ExpandingDirection QwtPlotRescaler::expandingDirection (QwtAxisId axisId) const
Returns
Parameters
See also
Definition at line 197 of file qwt_plot_rescaler.cpp.
QwtInterval QwtPlotRescaler::expandInterval (const QwtInterval & interval, double width, ExpandingDirection direction) const [protected]
Expand the interval
Parameters
width Distance to be added to the interval
direction Direction of the expand operation
Returns
Definition at line 526 of file qwt_plot_rescaler.cpp.
QwtInterval QwtPlotRescaler::expandScale (QwtAxisId axisId, const QSize & oldSize, const QSize & newSize) const [protected], [virtual]
Calculate the new scale interval of a plot axis
Parameters
oldSize Previous size of the canvas
newSize New size of the canvas
Returns
Definition at line 405 of file qwt_plot_rescaler.cpp.
QwtInterval QwtPlotRescaler::interval (QwtAxisId axisId) const [protected]
Parameters
Returns
Definition at line 509 of file qwt_plot_rescaler.cpp.
QwtInterval QwtPlotRescaler::intervalHint (QwtAxisId axisId) const
Parameters
Returns
See also
Definition at line 273 of file qwt_plot_rescaler.cpp.
bool QwtPlotRescaler::isEnabled () const
Returns
See also
Definition at line 118 of file qwt_plot_rescaler.cpp.
Qt::Orientation QwtPlotRescaler::orientation (QwtAxisId axisId) const [protected]
Returns
Parameters
Definition at line 500 of file qwt_plot_rescaler.cpp.
QwtPlot * QwtPlotRescaler::plot ()
Returns
Definition at line 294 of file qwt_plot_rescaler.cpp.
const QwtPlot * QwtPlotRescaler::plot () const
Returns
Definition at line 304 of file qwt_plot_rescaler.cpp.
QwtAxisId QwtPlotRescaler::referenceAxis () const
Returns
See also
Definition at line 158 of file qwt_plot_rescaler.cpp.
void QwtPlotRescaler::rescale (const QSize & oldSize, const QSize & newSize) const [protected], [virtual]
Adjust the plot axes scales
Parameters
newSize New size of the canvas
Definition at line 367 of file qwt_plot_rescaler.cpp.
QwtPlotRescaler::RescalePolicy QwtPlotRescaler::rescalePolicy () const
Returns
See also
Definition at line 138 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
Parameters
See also
Definition at line 212 of file qwt_plot_rescaler.cpp.
void QwtPlotRescaler::setAspectRatio (QwtAxisId axisId, double ratio)
Set the aspect ratio between the scale of the reference axis and another scale. The default ratio is 1.0
Parameters
ratio Aspect ratio
See also
Definition at line 226 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.
Parameters
See also
Definition at line 97 of file qwt_plot_rescaler.cpp.
void QwtPlotRescaler::setExpandingDirection (ExpandingDirection direction)
Set the direction in which all axis should be expanded
Parameters
See also
Definition at line 169 of file qwt_plot_rescaler.cpp.
void QwtPlotRescaler::setExpandingDirection (QwtAxisId axisId, ExpandingDirection direction)
Set the direction in which an axis should be expanded
Parameters
direction Direction
See also
Definition at line 183 of file qwt_plot_rescaler.cpp.
void QwtPlotRescaler::setIntervalHint (QwtAxisId axisId, 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.
Parameters
interval Axis
See also
Definition at line 261 of file qwt_plot_rescaler.cpp.
void QwtPlotRescaler::setReferenceAxis (QwtAxisId axisId)
Set the reference axis ( see RescalePolicy )
Parameters
See also
Definition at line 149 of file qwt_plot_rescaler.cpp.
void QwtPlotRescaler::setRescalePolicy (RescalePolicy policy)
Change the rescale policy
Parameters
See also
Definition at line 129 of file qwt_plot_rescaler.cpp.
QwtInterval QwtPlotRescaler::syncScale (QwtAxisId axisId, const QwtInterval & reference, const QSize & size) const [protected], [virtual]
Synchronize an axis scale according to the scale of the reference axis
Parameters
reference Interval of the reference axis
size Size of the canvas
Returns
Definition at line 469 of file qwt_plot_rescaler.cpp.
void QwtPlotRescaler::updateScales (QwtInterval intervals[QwtAxis::AxisPositions]) const [protected], [virtual]
Update the axes scales
Parameters
Definition at line 588 of file qwt_plot_rescaler.cpp.
Author
Generated automatically by Doxygen for Qwt User's Guide from the source code.
Sun Jul 18 2021 | Version 6.2.0 |