QwtPlotRescaler − QwtPlotRescaler takes care of fixed aspect ratios for plot scales.
#include <qwt_plot_rescaler.h>
Inherits QObject.
enum
RescalePolicy { Fixed, Expanding,
Fitting }
enum ExpandingDirection { ExpandUp,
ExpandDown, ExpandBoth }
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.
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
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.
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.
The rescale policy defines how to rescale the reference axis and their depending axes.
See also
ExpandingDirection, setIntervalHint()
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
Parameters
canvas Canvas
referenceAxis Reference axis, see RescalePolicy
policy Rescale policy
See also
setRescalePolicy(), setReferenceAxis()
Definition at line 71 of file qwt_plot_rescaler.cpp.
Destructor.
Definition at line 83 of file qwt_plot_rescaler.cpp.
Returns
Aspect ratio between an axis and the reference axis.
Parameters
axisId Axis
See also
setAspectRatio()
Definition at line 243 of file qwt_plot_rescaler.cpp.
Returns
plot canvas
Definition at line 282 of file qwt_plot_rescaler.cpp.
Returns
plot canvas
Definition at line 288 of file qwt_plot_rescaler.cpp.
Event handler for resize events of the plot canvas
Parameters
event Resize event
See also
rescale()
Definition at line 343 of file qwt_plot_rescaler.cpp.
Event filter for the plot canvas.
Definition at line 314 of file qwt_plot_rescaler.cpp.
Returns
Direction in which an axis should be expanded
Parameters
axisId Axis
See also
setExpandingDirection()
Definition at line 197 of file qwt_plot_rescaler.cpp.
Expand the interval
Parameters
interval Interval to be
expanded
width Distance to be added to the interval
direction Direction of the expand operation
Returns
Expanded interval
Definition at line 526 of file qwt_plot_rescaler.cpp.
Calculate the new scale interval of a plot axis
Parameters
axisId Axis
oldSize Previous size of the canvas
newSize New size of the canvas
Returns
Calculated new interval for the axis
Definition at line 405 of file qwt_plot_rescaler.cpp.
Parameters
axisId Axis
Returns
Normalized interval of an axis
Definition at line 509 of file qwt_plot_rescaler.cpp.
Parameters
axisId Axis
Returns
Interval hint
See also
setIntervalHint(), RescalePolicy
Definition at line 273 of file qwt_plot_rescaler.cpp.
Returns
true when enabled, false otherwise
See also
setEnabled, eventFilter()
Definition at line 118 of file qwt_plot_rescaler.cpp.
Returns
Orientation of an axis
Parameters
axisId Axis
Definition at line 500 of file qwt_plot_rescaler.cpp.
Returns
plot widget
Definition at line 294 of file qwt_plot_rescaler.cpp.
Returns
plot widget
Definition at line 304 of file qwt_plot_rescaler.cpp.
Returns
Reference axis ( see RescalePolicy )
See also
setReferenceAxis()
Definition at line 158 of file qwt_plot_rescaler.cpp.
Adjust the plot axes scales.
Definition at line 355 of file qwt_plot_rescaler.cpp.
Adjust the plot axes scales
Parameters
oldSize Previous size of
the canvas
newSize New size of the canvas
Definition at line 367 of file qwt_plot_rescaler.cpp.
Returns
Rescale policy
See also
setRescalePolicy()
Definition at line 138 of file qwt_plot_rescaler.cpp.
Set the aspect ratio between the scale of the reference axis and the other scales. The default ratio is 1.0
Parameters
ratio Aspect ratio
See also
aspectRatio()
Definition at line 212 of file qwt_plot_rescaler.cpp.
Set the aspect ratio between the scale of the reference axis and another scale. The default ratio is 1.0
Parameters
axisId Axis
ratio Aspect ratio
See also
aspectRatio()
Definition at line 226 of file qwt_plot_rescaler.cpp.
En/disable the rescaler. When enabled is true an event filter is installed for the canvas, otherwise the event filter is removed.
Parameters
on true or false
See also
isEnabled(), eventFilter()
Definition at line 97 of file qwt_plot_rescaler.cpp.
Set the direction in which all axis should be expanded
Parameters
direction Direction
See also
expandingDirection()
Definition at line 169 of file qwt_plot_rescaler.cpp.
Set the direction in which an axis should be expanded
Parameters
axisId Axis
direction Direction
See also
expandingDirection()
Definition at line 183 of file qwt_plot_rescaler.cpp.
Set an interval hint for an axis
In Fitting mode, the hint is used as minimal interval that always needs to be displayed.
Parameters
axisId Axis
interval Axis
See also
intervalHint(), RescalePolicy
Definition at line 261 of file qwt_plot_rescaler.cpp.
Set the reference axis ( see RescalePolicy )
Parameters
axisId Axis
See also
referenceAxis()
Definition at line 149 of file qwt_plot_rescaler.cpp.
Change the rescale policy
Parameters
policy Rescale policy
See also
rescalePolicy()
Definition at line 129 of file qwt_plot_rescaler.cpp.
Synchronize an axis scale according to the scale of the reference axis
Parameters
axisId Axis
reference Interval of the reference axis
size Size of the canvas
Returns
New interval for axis
Definition at line 469 of file qwt_plot_rescaler.cpp.
Update the axes scales
Parameters
intervals Scale intervals
Definition at line 588 of file qwt_plot_rescaler.cpp.
Generated automatically by Doxygen for Qwt User’s Guide from the source code.