! \internal Returns the point which closes the fill polygon on the zero-value-line parallel to the key axis. The logarithmic axis scale case is a bit special, since the zero-value-line in pixel coordinates is in positive or negative infinity. So this case is handled separately by just closing the fill polygon on the axis which lies in the direction towards the zero value. \a matching
| 21306 | y value of the returned point, respectively. |
| 21307 | */ |
| 21308 | QPointF QCPGraph::getFillBasePoint(QPointF matchingDataPoint) const |
| 21309 | { |
| 21310 | QCPAxis *keyAxis = mKeyAxis.data(); |
| 21311 | QCPAxis *valueAxis = mValueAxis.data(); |
| 21312 | if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return QPointF(); } |
| 21313 | |
| 21314 | QPointF result; |
| 21315 | if (valueAxis->scaleType() == QCPAxis::stLinear) |
| 21316 | { |
| 21317 | if (keyAxis->orientation() == Qt::Horizontal) |
| 21318 | { |
| 21319 | result.setX(matchingDataPoint.x()); |
| 21320 | result.setY(valueAxis->coordToPixel(0)); |
| 21321 | } else // keyAxis->orientation() == Qt::Vertical |
| 21322 | { |
| 21323 | result.setX(valueAxis->coordToPixel(0)); |
| 21324 | result.setY(matchingDataPoint.y()); |
| 21325 | } |
| 21326 | } else // valueAxis->mScaleType == QCPAxis::stLogarithmic |
| 21327 | { |
| 21328 | // In logarithmic scaling we can't just draw to value 0 so we just fill all the way |
| 21329 | // to the axis which is in the direction towards 0 |
| 21330 | if (keyAxis->orientation() == Qt::Vertical) |
| 21331 | { |
| 21332 | if ((valueAxis->range().upper < 0 && !valueAxis->rangeReversed()) || |
| 21333 | (valueAxis->range().upper > 0 && valueAxis->rangeReversed())) // if range is negative, zero is on opposite side of key axis |
| 21334 | result.setX(keyAxis->axisRect()->right()); |
| 21335 | else |
| 21336 | result.setX(keyAxis->axisRect()->left()); |
| 21337 | result.setY(matchingDataPoint.y()); |
| 21338 | } else if (keyAxis->axisType() == QCPAxis::atTop || keyAxis->axisType() == QCPAxis::atBottom) |
| 21339 | { |
| 21340 | result.setX(matchingDataPoint.x()); |
| 21341 | if ((valueAxis->range().upper < 0 && !valueAxis->rangeReversed()) || |
| 21342 | (valueAxis->range().upper > 0 && valueAxis->rangeReversed())) // if range is negative, zero is on opposite side of key axis |
| 21343 | result.setY(keyAxis->axisRect()->top()); |
| 21344 | else |
| 21345 | result.setY(keyAxis->axisRect()->bottom()); |
| 21346 | } |
| 21347 | } |
| 21348 | return result; |
| 21349 | } |
| 21350 | |
| 21351 | /*! \internal |
| 21352 |
nothing calls this directly
no test coverage detected