Go to the documentation of this file.
107 w->installEventFilter(
this );
109 w->removeEventFilter(
this );
187 axisData->expandingDirection = direction;
200 return axisData->expandingDirection;
233 axisData->aspectRatio = ratio;
246 return axisData->aspectRatio;
276 return axisData->intervalHint;
284 return qobject_cast< QWidget* >( parent() );
290 return qobject_cast< const QWidget* >( parent() );
298 w = w->parentWidget();
300 return qobject_cast< QwtPlot* >( w );
306 const QWidget* w =
canvas();
308 w = w->parentWidget();
310 return qobject_cast< const QwtPlot* >( w );
316 if (
object &&
object ==
canvas() )
318 switch ( event->type() )
325 case QEvent::PolishRequest:
345 const QMargins m =
canvas()->contentsMargins();
346 const QSize marginSize( m.left() + m.right(), m.top() + m.bottom() );
348 const QSize newSize =
event->size() - marginSize;
349 const QSize oldSize =
event->oldSize() - marginSize;
357 const QSize
size =
canvas()->contentsRect().size();
368 const QSize& oldSize,
const QSize& newSize )
const
370 if ( newSize.isEmpty() )
377 intervals[axisPos] =
interval( axisId );
381 intervals[refAxis] =
expandScale( refAxis, oldSize, newSize );
386 if (
aspectRatio( axisId ) > 0.0 && axisId != refAxis )
389 axisId, intervals[refAxis], newSize );
406 const QSize& oldSize,
const QSize& newSize )
const
419 if ( !oldSize.isEmpty() )
421 double width = oldInterval.
width();
423 width *= double( newSize.width() ) / oldSize.width();
425 width *= double( newSize.height() ) / oldSize.height();
438 const double d =
pixelDist( axisId, newSize );
446 width = newSize.width() * dist;
448 width = newSize.height() * dist;
479 dist *=
size.width();
481 dist *=
size.height();
511 if ( !
plot()->isAxisValid( axisId ) )
568 dist = intv.
width() * r;
575 dist /=
size.width();
577 dist /=
size.height();
608 double v1 = intervals[axisPos].minValue();
609 double v2 = intervals[axisPos].maxValue();
635 bool immediatePaint =
false;
648 if (
canvas && immediatePaint )
655 #include "moc_qwt_plot_rescaler.cpp"
void setAspectRatio(double ratio)
basic_reference< false > reference
void setIntervalHint(QwtAxisId, const QwtInterval &)
bool isYAxis(int axisPos)
void setExpandingDirection(ExpandingDirection)
virtual ~QwtPlotRescaler()
Destructor.
@ ExpandDown
The lower limit of the scale is adjusted.
void setReferenceAxis(QwtAxisId)
void setAxisScale(QwtAxisId, double min, double max, double stepSize=0)
Disable autoscaling and specify a fixed scale for a selected axis.
void setAutoReplot(bool=true)
Set or reset the autoReplot option.
RescalePolicy rescalePolicy() const
QwtPlotRescaler(QWidget *canvas, QwtAxisId referenceAxis=QwtAxis::XBottom, RescalePolicy=Expanding)
QwtPlotRescaler::AxisData * axisData(QwtAxisId axisId)
virtual void canvasResizeEvent(QResizeEvent *)
QList< double > ticks(int tickType) const
span_constexpr std::size_t size(span< T, Extent > const &spn)
A class representing an interval.
@ NTickTypes
Number of valid tick types.
void rescale() const
Adjust the plot axes scales.
QwtPlotRescaler takes care of fixed aspect ratios for plot scales.
bool isIncreasing() const
Check if the scale division is increasing( lowerBound() <= upperBound() )
double width() const
Return the width of an interval.
QwtInterval interval(QwtAxisId) const
QwtInterval intervalHint(QwtAxisId) const
virtual bool eventFilter(QObject *, QEvent *) QWT_OVERRIDE
Event filter for the plot canvas.
const QwtScaleDiv & axisScaleDiv(QwtAxisId) const
Return the scale division of a specified axis.
QwtPlotRescaler::AxisData m_axisData[QwtAxis::AxisPositions]
int QwtAxisId
Axis identifier.
@ ExpandUp
The upper limit of the scale is adjusted.
void setAxisScaleDiv(QwtAxisId, const QwtScaleDiv &)
Disable autoscaling and specify a fixed scale for a selected axis.
virtual QwtInterval syncScale(QwtAxisId, const QwtInterval &reference, const QSize &size) const
@ ExpandBoth
Both limits of the scale are adjusted.
ExpandingDirection expandingDirection(QwtAxisId) const
QwtPlotRescaler::ExpandingDirection expandingDirection
RescalePolicy rescalePolicy
virtual void replot()
Redraw the plot.
QwtInterval normalized() const
Normalize the limits of the interval.
QwtInterval expandInterval(const QwtInterval &, double width, ExpandingDirection) const
QwtAxisId referenceAxis() const
double pixelDist(QwtAxisId, const QSize &) const
virtual void updateScales(QwtInterval intervals[QwtAxis::AxisPositions]) const
A class representing a scale division.
virtual QwtInterval expandScale(QwtAxisId, const QSize &oldSize, const QSize &newSize) const
void setEnabled(bool)
En/disable the rescaler.
double aspectRatio(QwtAxisId) const
QwtInterval interval() const
bool isValid(int axisPos)
Qt::Orientation orientation(QwtAxisId) const
void setRescalePolicy(RescalePolicy)
@ XBottom
X axis below the canvas.
plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:46