MCPcopy Create free account
hub / github.com/CieNTi/serial_port_plotter / setScaleRatio

Method setScaleRatio

qcustomplot/qcustomplot.cpp:8493–8509  ·  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

8491 will follow.
8492*/
8493void QCPAxis::setScaleRatio(const QCPAxis *otherAxis, double ratio)
8494{
8495 int otherPixelSize, ownPixelSize;
8496
8497 if (otherAxis->orientation() == Qt::Horizontal)
8498 otherPixelSize = otherAxis->axisRect()->width();
8499 else
8500 otherPixelSize = otherAxis->axisRect()->height();
8501
8502 if (orientation() == Qt::Horizontal)
8503 ownPixelSize = axisRect()->width();
8504 else
8505 ownPixelSize = axisRect()->height();
8506
8507 double newRangeSize = ratio*otherAxis->range().size()*ownPixelSize/(double)otherPixelSize;
8508 setRange(range().center(), newRangeSize, Qt::AlignCenter);
8509}
8510
8511/*!
8512 Changes the axis range such that all plottables associated with this axis are fully visible in

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected