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

Method findIndexBelowX

qcustomplot/qcustomplot.cpp:21583–21596  ·  view source on GitHub ↗

! \internal Finds the highest index of \a data, whose points x value is just below \a x. Assumes x values in \a data points are ordered ascending, as is ensured by \ref getLines/\ref getScatters if the key axis is horizontal. Used to calculate the channel fill polygon, see \ref getChannelFillPolygon. */

Source from the content-addressed store, hash-verified

21581 Used to calculate the channel fill polygon, see \ref getChannelFillPolygon.
21582*/
21583int QCPGraph::findIndexBelowX(const QVector<QPointF> *data, double x) const
21584{
21585 for (int i=0; i<data->size(); ++i)
21586 {
21587 if (data->at(i).x() > x)
21588 {
21589 if (i>0)
21590 return i-1;
21591 else
21592 return 0;
21593 }
21594 }
21595 return -1;
21596}
21597
21598/*! \internal
21599

Callers

nothing calls this directly

Calls 2

atMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected