SeriesUtils { protected static int iBoundsMin(XYSeries series, double visibleMin, float step) { int min = 0; final int steps = (int) Math.ceil(series.size() / step); for (int stepIndex = 1; stepIndex <= steps; stepIndex++) { final int i = stepIndex * (int) step; for (int ii = 1; ii <= step; ii++) { final int iii = i - ii; if(iii < 0) { break; } if(iii < series.size()) { final Number thisX = series.getX(iii); if (thisX != null) { if (thisX.doubleValue() < visibleMin) { min = iii; break; } else if (thisX.doubleValue() == visibleMin) { return iii; } else { return min; } } } } } return min; }  static RectRegion minMax(List<XYSeries> seriesList); static RectRegion minMax(XYSeries... seriesList); static Region minMaxX(XYSeries... seriesList); static Region minMaxY(XYSeries... seriesList); static RectRegion minMax(XYConstraints constraints, List<XYSeries> seriesList); static RectRegion minMax(XYConstraints constraints, XYSeries... seriesArray); static Region minMax(Region bounds, List<Number>... lists); static Region iBounds(XYSeries series, RectRegion visibleBounds); static Region minMax(List<Number>... lists); static OrderedXYSeries.XOrder getXYOrder(XYSeries series);  }
@Test public void iBoundsMin_findsMin() { XYSeries s1 = new SimpleXYSeries( Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12), Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12), "s1"); assertEquals(0, SeriesUtils.iBoundsMin(s1, 0, 1)); assertEquals(6, SeriesUtils.iBoundsMin(s1, 6, 1)); assertEquals(12, SeriesUtils.iBoundsMin(s1, 12, 1)); XYSeries s2 = new SimpleXYSeries( Arrays.asList(null, 1, 2, null, null, 5, 6, 7, 8, null, 10, 11, null), Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12), "s2"); assertEquals(0, SeriesUtils.iBoundsMin(s2, 0, 1)); assertEquals(2, SeriesUtils.iBoundsMin(s2, 3, 1)); assertEquals(11, SeriesUtils.iBoundsMin(s2, 12, 1)); assertEquals(0, SeriesUtils.iBoundsMin(s2, 0, 5)); assertEquals(2, SeriesUtils.iBoundsMin(s2, 3, 5)); assertEquals(11, SeriesUtils.iBoundsMin(s2, 12, 5)); }