MCPcopy Create free account
hub / github.com/collin80/SavvyCAN / getFillBasePoint

Method getFillBasePoint

qcustomplot.cpp:21363–21404  ·  view source on GitHub ↗

! \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

Source from the content-addressed store, hash-verified

21361 y value of the returned point, respectively.
21362*/
21363QPointF QCPGraph::getFillBasePoint(QPointF matchingDataPoint) const
21364{
21365 QCPAxis *keyAxis = mKeyAxis.data();
21366 QCPAxis *valueAxis = mValueAxis.data();
21367 if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return QPointF(); }
21368
21369 QPointF result;
21370 if (valueAxis->scaleType() == QCPAxis::stLinear)
21371 {
21372 if (keyAxis->orientation() == Qt::Horizontal)
21373 {
21374 result.setX(matchingDataPoint.x());
21375 result.setY(valueAxis->coordToPixel(0));
21376 } else // keyAxis->orientation() == Qt::Vertical
21377 {
21378 result.setX(valueAxis->coordToPixel(0));
21379 result.setY(matchingDataPoint.y());
21380 }
21381 } else // valueAxis->mScaleType == QCPAxis::stLogarithmic
21382 {
21383 // In logarithmic scaling we can't just draw to value 0 so we just fill all the way
21384 // to the axis which is in the direction towards 0
21385 if (keyAxis->orientation() == Qt::Vertical)
21386 {
21387 if ((valueAxis->range().upper < 0 && !valueAxis->rangeReversed()) ||
21388 (valueAxis->range().upper > 0 && valueAxis->rangeReversed())) // if range is negative, zero is on opposite side of key axis
21389 result.setX(keyAxis->axisRect()->right());
21390 else
21391 result.setX(keyAxis->axisRect()->left());
21392 result.setY(matchingDataPoint.y());
21393 } else if (keyAxis->axisType() == QCPAxis::atTop || keyAxis->axisType() == QCPAxis::atBottom)
21394 {
21395 result.setX(matchingDataPoint.x());
21396 if ((valueAxis->range().upper < 0 && !valueAxis->rangeReversed()) ||
21397 (valueAxis->range().upper > 0 && valueAxis->rangeReversed())) // if range is negative, zero is on opposite side of key axis
21398 result.setY(keyAxis->axisRect()->top());
21399 else
21400 result.setY(keyAxis->axisRect()->bottom());
21401 }
21402 }
21403 return result;
21404}
21405
21406/*! \internal
21407

Callers

nothing calls this directly

Calls 4

coordToPixelMethod · 0.80
rangeMethod · 0.80
axisRectMethod · 0.80
dataMethod · 0.45

Tested by

no test coverage detected