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

Method findIndexAboveY

qcustomplot/qcustomplot.cpp:21606–21619  ·  view source on GitHub ↗

! \internal Finds the smallest index of \a data, whose points y value is just above \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

21604 Used to calculate the channel fill polygon, see \ref getChannelFillPolygon.
21605*/
21606int QCPGraph::findIndexAboveY(const QVector<QPointF> *data, double y) const
21607{
21608 for (int i=data->size()-1; i>=0; --i)
21609 {
21610 if (data->at(i).y() < y)
21611 {
21612 if (i<data->size()-1)
21613 return i+1;
21614 else
21615 return data->size()-1;
21616 }
21617 }
21618 return -1;
21619}
21620
21621/*! \internal
21622

Callers

nothing calls this directly

Calls 2

atMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected