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

Method dataPixelPosition

qcustomplot.cpp:24026–24046  ·  view source on GitHub ↗

inherits documentation from base class */

Source from the content-addressed store, hash-verified

24024
24025/* inherits documentation from base class */
24026QPointF QCPBars::dataPixelPosition(int index) const
24027{
24028 if (index >= 0 && index < mDataContainer->size())
24029 {
24030 QCPAxis *keyAxis = mKeyAxis.data();
24031 QCPAxis *valueAxis = mValueAxis.data();
24032 if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return QPointF(); }
24033
24034 const QCPDataContainer<QCPBarsData>::const_iterator it = mDataContainer->constBegin()+index;
24035 const double valuePixel = valueAxis->coordToPixel(getStackedBaseValue(it->key, it->value >= 0) + it->value);
24036 const double keyPixel = keyAxis->coordToPixel(it->key) + (mBarsGroup ? mBarsGroup->keyPixelOffset(this, it->key) : 0);
24037 if (keyAxis->orientation() == Qt::Horizontal)
24038 return QPointF(keyPixel, valuePixel);
24039 else
24040 return QPointF(valuePixel, keyPixel);
24041 } else
24042 {
24043 qDebug() << Q_FUNC_INFO << "Index out of bounds" << index;
24044 return QPointF();
24045 }
24046}
24047
24048/* inherits documentation from base class */
24049void 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