MCPcopy Create free account
hub / github.com/CloudCompare/CloudCompare / dataPixelPosition

Method dataPixelPosition

qCC/extern/QCustomPlot/qcustomplot.cpp:24784–24804  ·  view source on GitHub ↗

inherits documentation from base class */

Source from the content-addressed store, hash-verified

24782
24783/* inherits documentation from base class */
24784QPointF QCPBars::dataPixelPosition(int index) const
24785{
24786 if (index >= 0 && index < mDataContainer->size())
24787 {
24788 QCPAxis *keyAxis = mKeyAxis.data();
24789 QCPAxis *valueAxis = mValueAxis.data();
24790 if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return {}; }
24791
24792 const QCPDataContainer<QCPBarsData>::const_iterator it = mDataContainer->constBegin()+index;
24793 const double valuePixel = valueAxis->coordToPixel(getStackedBaseValue(it->key, it->value >= 0) + it->value);
24794 const double keyPixel = keyAxis->coordToPixel(it->key) + (mBarsGroup ? mBarsGroup->keyPixelOffset(this, it->key) : 0);
24795 if (keyAxis->orientation() == Qt::Horizontal)
24796 return {keyPixel, valuePixel};
24797 else
24798 return {valuePixel, keyPixel};
24799 } else
24800 {
24801 qDebug() << Q_FUNC_INFO << "Index out of bounds" << index;
24802 return {};
24803 }
24804}
24805
24806/* inherits documentation from base class */
24807void QCPBars::draw(QCPPainter *painter)

Callers 2

getErrorBarLinesMethod · 0.45
errorBarVisibleMethod · 0.45

Calls 5

constBeginMethod · 0.80
coordToPixelMethod · 0.80
keyPixelOffsetMethod · 0.80
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected