[apps/regression] Fix vertical navigation if 2 series have same point

Data set:
X1: 8 9 10 10
Y1: 2 5 1  2

X2: 10 12 5
Y2: 2  0  8
This commit is contained in:
Léa Saviot
2018-12-12 14:13:58 +01:00
committed by LeaNumworks
parent de339c44ae
commit 15c5d2af1b

View File

@@ -61,7 +61,9 @@ int Store::closestVerticalDot(int direction, double x, double y, int currentSeri
double currentY = i < numberOfPoints ? m_data[series][1][i] : meanOfColumn(series, 1);
if (m_xMin <= currentX && currentX <= m_xMax // The next dot is within the window abscissa bounds
&& (std::fabs(currentX - x) <= std::fabs(nextX - x)) // The next dot is the closest to x in abscissa
&& ((currentY >= y) == (direction > 0)) // The next dot is above/under y
&& ((currentY > y && direction > 0) // The next dot is above/under y
|| (currentY < y && direction < 0)
|| (currentY == y && (currentDot < 0 || ((direction < 0) == (series > currentSeries)))))
&& (nextX != currentX // Edge case: if 2 dots have the same abscissa but different ordinates
|| ((currentY <= nextY) == (direction > 0))))
{