MCPcopy Create free account
hub / github.com/LUX-Core/lux / setScaleRatio

Method setScaleRatio

src/qt/qcustomplot.cpp:8482–8498  ·  view source on GitHub ↗

! Scales the range of this axis to have a certain scale \a ratio to \a otherAxis. The scaling will be done around the center of the current axis range. For example, if \a ratio is 1, this axis is the \a yAxis and \a otherAxis is \a xAxis, graphs plotted with those axes will appear in a 1:1 aspect ratio, independent of the aspect ratio the axis rect has. This is an operation that chan

Source from the content-addressed store, hash-verified

8480 will follow.
8481*/
8482void QCPAxis::setScaleRatio(const QCPAxis *otherAxis, double ratio)
8483{
8484 int otherPixelSize, ownPixelSize;
8485
8486 if (otherAxis->orientation() == Qt::Horizontal)
8487 otherPixelSize = otherAxis->axisRect()->width();
8488 else
8489 otherPixelSize = otherAxis->axisRect()->height();
8490
8491 if (orientation() == Qt::Horizontal)
8492 ownPixelSize = axisRect()->width();
8493 else
8494 ownPixelSize = axisRect()->height();
8495
8496 double newRangeSize = ratio*otherAxis->range().size()*ownPixelSize/(double)otherPixelSize;
8497 setRange(range().center(), newRangeSize, Qt::AlignCenter);
8498}
8499
8500/*!
8501 Changes the axis range such that all plottables associated with this axis are fully visible in

Callers

nothing calls this directly

Calls 7

orientationFunction · 0.85
axisRectFunction · 0.85
rangeFunction · 0.85
axisRectMethod · 0.80
rangeMethod · 0.80
centerMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected