16 #include <qalgorithms.h> 97 w->installEventFilter(
this );
99 w->removeEventFilter(
this );
272 return qobject_cast<QWidget *>( parent() );
278 return qobject_cast<
const QWidget *>( parent() );
286 w = w->parentWidget();
288 return qobject_cast<
QwtPlot *>( w );
296 w = w->parentWidget();
298 return qobject_cast<
const QwtPlot *>( w );
304 if (
object &&
object ==
canvas() )
306 switch ( event->type() )
313 case QEvent::PolishRequest:
333 int left, top, right, bottom;
334 canvas()->getContentsMargins( &left, &top, &right, &bottom );
336 const QSize marginSize( left + right, top + bottom );
338 const QSize newSize =
event->size() - marginSize;
339 const QSize oldSize =
event->oldSize() - marginSize;
347 const QSize
size =
canvas()->contentsRect().size();
358 const QSize &oldSize,
const QSize &newSize )
const 360 if ( newSize.isEmpty() )
368 intervals[refAxis] =
expandScale( refAxis, oldSize, newSize );
372 if (
aspectRatio( axis ) > 0.0 && axis != refAxis )
373 intervals[axis] =
syncScale( axis, intervals[refAxis], newSize );
389 const QSize &oldSize,
const QSize &newSize )
const 402 if ( !oldSize.isEmpty() )
404 double width = oldInterval.
width();
406 width *= double( newSize.width() ) / oldSize.width();
408 width *= double( newSize.height() ) / oldSize.height();
428 width = newSize.width() * dist;
430 width = newSize.height() * dist;
452 const QwtInterval& reference,
const QSize &size )
const 456 dist = reference.
width() / size.width();
458 dist = reference.
width() / size.height();
461 dist *= size.width();
463 dist *= size.height();
487 return Qt::Horizontal;
532 interval.
width() / 2.0 - width / 2.0 );
551 dist = intv.
width() * r;
558 dist /= size.width();
560 dist /= size.height();
588 double v1 = intervals[axis].minValue();
589 double v2 = intervals[axis].maxValue();
614 bool immediatePaint =
false;
627 if ( canvas && immediatePaint )
const QwtScaleDiv & axisScaleDiv(int axisId) const
Return the scale division of a specified axis.
void setRescalePolicy(RescalePolicy)
QwtInterval normalized() const
Normalize the limits of the interval.
A class representing an interval.
virtual void canvasResizeEvent(QResizeEvent *)
void setReferenceAxis(int axis)
QwtInterval interval(int axis) const
QwtInterval expandInterval(const QwtInterval &, double width, ExpandingDirection) const
void setAutoReplot(bool=true)
Set or reset the autoReplot option.
Y axis right of the canvas.
virtual void replot()
Redraw the plot.
double aspectRatio(int axis) const
A class representing a scale division.
bool testPaintAttribute(PaintAttribute) const
Y axis left of the canvas.
int referenceAxis() const
virtual QwtInterval expandScale(int axis, const QSize &oldSize, const QSize &newSize) const
void setAxisScaleDiv(int axisId, const QwtScaleDiv &)
Disable autoscaling and specify a fixed scale for a selected axis.
QwtPlotRescaler::AxisData axisData[QwtPlot::axisCnt]
QwtPlotRescaler(QWidget *canvas, int referenceAxis=QwtPlot::xBottom, RescalePolicy=Expanding)
QwtInterval intervalHint(int axis) const
virtual bool eventFilter(QObject *, QEvent *)
Event filter for the plot canvas.
The lower limit of the scale is adjusted.
void setExpandingDirection(ExpandingDirection)
void setEnabled(bool)
En/disable the rescaler.
Both limits of the scale are adjusted.
virtual ~QwtPlotRescaler()
Destructor.
void rescale() const
Adjust the plot axes scales.
QwtPlotRescaler takes care of fixed aspect ratios for plot scales.
RescalePolicy rescalePolicy
void setPaintAttribute(PaintAttribute, bool on=true)
Changing the paint attributes.
Number of valid tick types.
ExpandingDirection expandingDirection(int axis) const
bool isIncreasing() const
Check if the scale division is increasing( lowerBound() <= upperBound() )
QwtPlotRescaler::ExpandingDirection expandingDirection
TFSIMD_FORCE_INLINE const tfScalar & w() const
Qt::Orientation orientation(int axis) const
The upper limit of the scale is adjusted.
void setAspectRatio(double ratio)
QwtInterval interval() const
virtual void updateScales(QwtInterval intervals[QwtPlot::axisCnt]) const
double width() const
Return the width of an interval.
QList< double > ticks(int tickType) const
double pixelDist(int axis, const QSize &) const
void setAxisScale(int axisId, double min, double max, double step=0)
Disable autoscaling and specify a fixed scale for a selected axis.
virtual QwtInterval syncScale(int axis, const QwtInterval &reference, const QSize &size) const
RescalePolicy rescalePolicy() const
void setIntervalHint(int axis, const QwtInterval &)