MCPcopy Create free account
hub / github.com/Audio4Linux/JDSP4Linux / dataPixelPosition

Method dataPixelPosition

3rdparty/qcustomplot/qcustomplot.cpp:24819–24839  ·  view source on GitHub ↗

inherits documentation from base class */

Source from the content-addressed store, hash-verified

24817
24818/* inherits documentation from base class */
24819QPointF QCPBars::dataPixelPosition(int index) const
24820{
24821 if (index >= 0 && index < mDataContainer->size())
24822 {
24823 QCPAxis *keyAxis = mKeyAxis.data();
24824 QCPAxis *valueAxis = mValueAxis.data();
24825 if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return {}; }
24826
24827 const QCPDataContainer<QCPBarsData>::const_iterator it = mDataContainer->constBegin()+index;
24828 const double valuePixel = valueAxis->coordToPixel(getStackedBaseValue(it->key, it->value >= 0) + it->value);
24829 const double keyPixel = keyAxis->coordToPixel(it->key) + (mBarsGroup ? mBarsGroup->keyPixelOffset(this, it->key) : 0);
24830 if (keyAxis->orientation() == Qt::Horizontal)
24831 return {keyPixel, valuePixel};
24832 else
24833 return {valuePixel, keyPixel};
24834 } else
24835 {
24836 qDebug() << Q_FUNC_INFO << "Index out of bounds" << index;
24837 return {};
24838 }
24839}
24840
24841/* inherits documentation from base class */
24842void 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