! 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
| 9191 | will follow. |
| 9192 | */ |
| 9193 | void QCPAxis::setScaleRatio(const QCPAxis *otherAxis, double ratio) |
| 9194 | { |
| 9195 | int otherPixelSize, ownPixelSize; |
| 9196 | |
| 9197 | if (otherAxis->orientation() == Qt::Horizontal) |
| 9198 | otherPixelSize = otherAxis->axisRect()->width(); |
| 9199 | else |
| 9200 | otherPixelSize = otherAxis->axisRect()->height(); |
| 9201 | |
| 9202 | if (orientation() == Qt::Horizontal) |
| 9203 | ownPixelSize = axisRect()->width(); |
| 9204 | else |
| 9205 | ownPixelSize = axisRect()->height(); |
| 9206 | |
| 9207 | double newRangeSize = ratio*otherAxis->range().size()*ownPixelSize/double(otherPixelSize); |
| 9208 | setRange(range().center(), newRangeSize, Qt::AlignCenter); |
| 9209 | } |
| 9210 | |
| 9211 | /*! |
| 9212 | Changes the axis range such that all plottables associated with this axis are fully visible in |