MCPcopy Create free account
hub / github.com/CieNTi/serial_port_plotter / getPixelSpacing

Method getPixelSpacing

qcustomplot/qcustomplot.cpp:23461–23483  ·  view source on GitHub ↗

! \internal Returns the spacing in pixels which is between this \a bars and the following one, both at the key coordinate \a keyCoord. \note Typically the returned value doesn't depend on \a bars or \a keyCoord. \a bars is only needed to get access to the key axis transformation and axis rect for the modes \ref stAxisRectRatio and \ref stPlotCoords. The \a keyCoord is only relevant

Source from the content-addressed store, hash-verified

23459 \ref stPlotCoords on a logarithmic axis.
23460*/
23461double QCPBarsGroup::getPixelSpacing(const QCPBars *bars, double keyCoord)
23462{
23463 switch (mSpacingType)
23464 {
23465 case stAbsolute:
23466 {
23467 return mSpacing;
23468 }
23469 case stAxisRectRatio:
23470 {
23471 if (bars->keyAxis()->orientation() == Qt::Horizontal)
23472 return bars->keyAxis()->axisRect()->width()*mSpacing;
23473 else
23474 return bars->keyAxis()->axisRect()->height()*mSpacing;
23475 }
23476 case stPlotCoords:
23477 {
23478 double keyPixel = bars->keyAxis()->coordToPixel(keyCoord);
23479 return qAbs(bars->keyAxis()->coordToPixel(keyCoord+mSpacing)-keyPixel);
23480 }
23481 }
23482 return 0;
23483}
23484
23485
23486////////////////////////////////////////////////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 2

axisRectMethod · 0.80
coordToPixelMethod · 0.80

Tested by

no test coverage detected