Qwt User's Guide
6.0.1
|
#include <qwt_plot_rescaler.h>
Public Types | |
enum | ExpandingDirection { ExpandUp, ExpandDown, ExpandBoth } |
enum | RescalePolicy { Fixed, Expanding, Fitting } |
Public Member Functions | |
double | aspectRatio (int axis) const |
QwtPlotCanvas * | canvas () |
const QwtPlotCanvas * | canvas () const |
virtual bool | eventFilter (QObject *, QEvent *) |
ExpandingDirection | expandingDirection (int axis) const |
QwtInterval | intervalHint (int axis) const |
bool | isEnabled () const |
QwtPlot * | plot () |
const QwtPlot * | plot () const |
QwtPlotRescaler (QwtPlotCanvas *, int referenceAxis=QwtPlot::xBottom, RescalePolicy=Expanding) | |
int | referenceAxis () const |
void | rescale () const |
RescalePolicy | rescalePolicy () const |
void | setAspectRatio (double ratio) |
void | setAspectRatio (int axis, double ratio) |
void | setEnabled (bool) |
void | setExpandingDirection (ExpandingDirection) |
void | setExpandingDirection (int axis, ExpandingDirection) |
void | setIntervalHint (int axis, const QwtInterval &) |
void | setReferenceAxis (int axis) |
void | setRescalePolicy (RescalePolicy) |
virtual | ~QwtPlotRescaler () |
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 |
QwtPlotRescaler takes care of fixed aspect ratios for plot scales.
QwtPlotRescaler autoadjusts the axes of a QwtPlot according to fixed aspect ratios.
When rescalePolicy() is set to Expanding its direction depends on ExpandingDirection
The rescale policy defines how to rescale the reference axis and their depending axes.
QwtPlotRescaler::QwtPlotRescaler | ( | QwtPlotCanvas * | canvas, |
int | referenceAxis = QwtPlot::xBottom , |
||
RescalePolicy | policy = Expanding |
||
) | [explicit] |
Constructor
canvas | Canvas |
referenceAxis | Reference axis, see RescalePolicy |
policy | Rescale policy |
QwtPlotRescaler::~QwtPlotRescaler | ( | ) | [virtual] |
Destructor.
double QwtPlotRescaler::aspectRatio | ( | int | axis | ) | const |
Return aspect ratio between an axis and the reference axis.
axis | Axis index ( see QwtPlot::AxisId ) |
const QwtPlotCanvas * QwtPlotRescaler::canvas | ( | ) | const |
void QwtPlotRescaler::canvasResizeEvent | ( | QResizeEvent * | event | ) | [protected, virtual] |
bool QwtPlotRescaler::eventFilter | ( | QObject * | o, |
QEvent * | e | ||
) | [virtual] |
Event filter for the plot canvas.
QwtPlotRescaler::ExpandingDirection QwtPlotRescaler::expandingDirection | ( | int | axis | ) | const |
Return direction in which an axis should be expanded
axis | Axis index ( see QwtPlot::AxisId ) |
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 |
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 |
QwtInterval QwtPlotRescaler::interval | ( | int | axis | ) | const [protected] |
Return interval of an axis
axis | Axis index ( see QwtPlot::AxisId ) |
QwtInterval QwtPlotRescaler::intervalHint | ( | int | axis | ) | const |
axis | Axis, see QwtPlot::Axis |
bool QwtPlotRescaler::isEnabled | ( | ) | const |
Qt::Orientation QwtPlotRescaler::orientation | ( | int | axis | ) | const [protected] |
Return orientation of an axis
axis | Axis index ( see QwtPlot::AxisId ) |
QwtPlot * QwtPlotRescaler::plot | ( | ) |
const QwtPlot * QwtPlotRescaler::plot | ( | ) | const |
int QwtPlotRescaler::referenceAxis | ( | ) | const |
void QwtPlotRescaler::rescale | ( | ) | const |
Adjust the plot axes scales.
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 |
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 |
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 |
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 |
void QwtPlotRescaler::setExpandingDirection | ( | ExpandingDirection | direction | ) |
Set the direction in which all axis should be expanded
direction | Direction |
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 |
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 taht always needs to be displayed.
axis | Axis, see QwtPlot::Axis |
interval | Axis |
void QwtPlotRescaler::setReferenceAxis | ( | int | axis | ) |
Set the reference axis ( see RescalePolicy )
axis | Axis index ( QwtPlot::Axis ) |
void QwtPlotRescaler::setRescalePolicy | ( | RescalePolicy | policy | ) |
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 |
void QwtPlotRescaler::updateScales | ( | QwtInterval | intervals[QwtPlot::axisCnt] | ) | const [protected, virtual] |
Update the axes scales
intervals | Scale intervals |