MCPcopy Create free account
hub / github.com/LUX-Core/lux / dataPixelPosition

Method dataPixelPosition

src/qt/qcustomplot.cpp:23957–23977  ·  view source on GitHub ↗

inherits documentation from base class */

Source from the content-addressed store, hash-verified

23955
23956/* inherits documentation from base class */
23957QPointF QCPBars::dataPixelPosition(int index) const
23958{
23959 if (index >= 0 && index < mDataContainer->size())
23960 {
23961 QCPAxis *keyAxis = mKeyAxis.data();
23962 QCPAxis *valueAxis = mValueAxis.data();
23963 if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return QPointF(); }
23964
23965 const QCPDataContainer<QCPBarsData>::const_iterator it = mDataContainer->constBegin()+index;
23966 const double valuePixel = valueAxis->coordToPixel(getStackedBaseValue(it->key, it->value >= 0) + it->value);
23967 const double keyPixel = keyAxis->coordToPixel(it->key) + (mBarsGroup ? mBarsGroup->keyPixelOffset(this, it->key) : 0);
23968 if (keyAxis->orientation() == Qt::Horizontal)
23969 return QPointF(keyPixel, valuePixel);
23970 else
23971 return QPointF(valuePixel, keyPixel);
23972 } else
23973 {
23974 qDebug() << Q_FUNC_INFO << "Index out of bounds" << index;
23975 return QPointF();
23976 }
23977}
23978
23979/* inherits documentation from base class */
23980void 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