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

Method findIndexBelowY

qcustomplot/qcustomplot.cpp:21688–21701  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

21686 Used to calculate the channel fill polygon, see \ref getChannelFillPolygon.
21687*/
21688int QCPGraph::findIndexBelowY(const QVector<QPointF> *data, double y) const
21689{
21690 for (int i=0; i<data->size(); ++i)
21691 {
21692 if (data->at(i).y() > y)
21693 {
21694 if (i>0)
21695 return i-1;
21696 else
21697 return 0;
21698 }
21699 }
21700 return -1;
21701}
21702/* end of 'src/plottables/plottable-graph.cpp' */
21703
21704

Callers

nothing calls this directly

Calls 2

atMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected