11#include "qwt_scale_map.h"
12#include "qwt_plot_magnifier.h"
14class QwtPlotMagnifier::PrivateData
19 for (
int axis = 0; axis < QwtAxis::AxisPositions; axis++ )
20 isAxisEnabled[axis] =
true;
23 bool isAxisEnabled[QwtAxis::AxisPositions];
33 m_data =
new PrivateData();
56 m_data->isAxisEnabled[axisId] = on;
70 return m_data->isAxisEnabled[axisId];
92 w = w->parentWidget();
94 return qobject_cast< QwtPlot* >( w );
100 const QWidget* w =
canvas();
102 w = w->parentWidget();
104 return qobject_cast< const QwtPlot* >( w );
117 factor = qAbs( factor );
118 if ( factor == 1.0 || factor == 0.0 )
121 bool doReplot =
false;
126 for (
int axisPos = 0; axisPos < QwtAxis::AxisPositions; axisPos++ )
129 const QwtAxisId axisId( axisPos );
135 double v1 = scaleMap.
s1();
136 double v2 = scaleMap.
s2();
146 const double center = 0.5 * ( v1 + v2 );
147 const double width_2 = 0.5 * ( v2 - v1 ) * factor;
149 v1 = center - width_2;
150 v2 = center + width_2;
170#include "moc_qwt_plot_magnifier.cpp"
QwtMagnifier provides zooming, by magnifying in steps.
void setAxisScale(QwtAxisId, double min, double max, double stepSize=0)
Disable autoscaling and specify a fixed scale for a selected axis.
virtual void replot()
Redraw the plot.
void setAutoReplot(bool=true)
Set or reset the autoReplot option.
virtual QwtScaleMap canvasMap(QwtAxisId) const
virtual ~QwtPlotMagnifier()
Destructor.
void setAxisEnabled(QwtAxisId, bool on)
En/Disable an axis.
virtual void rescale(double factor) override
QwtPlotMagnifier(QWidget *)
QWidget * canvas()
Return observed plot canvas.
bool isAxisEnabled(QwtAxisId) const
QwtPlot * plot()
Return plot widget, containing the observed plot canvas.
double transform(double s) const
const QwtTransform * transformation() const
Get the transformation.
double invTransform(double p) const
bool isValid(int axisPos)