@SuppressWarnings("PointlessArithmeticExpression") public void computePointsWithinXRange(List<DataSet> dataSets){
  pointsCountWithinXRange=0;
  for (  DataSet dataSet : dataSets) {
    List<DataPoint> points=dataSet.getPoints();
    int size=points.size();
    for (int i=0; i < size; i++) {
      DataPoint p=points.get(i);
      if (p.x > viewportRect.left && p.x < viewportRect.right) {
        int length=xRangePoints.length;
        if (length < pointsCountWithinXRange * 2 + 2) {
          xRangePoints=new float[Math.round(length * 3 / 2)];
        }
        xRangePoints[pointsCountWithinXRange * 2 + 0]=p.x;
        xRangePoints[pointsCountWithinXRange * 2 + 1]=p.y;
        pointsCountWithinXRange++;
      }
    }
  }
}

@ SuppressWarnings ( "PointlessArithmeticExpression" ) public void computePointsWithinXRange ( List < DataSet > dataSets ) { pointsCountWithinXRange = 0 ; for ( DataSet dataSet : dataSets ) { List < DataPoint > points = dataSet . getPoints ( ) ; int size = points . size ( ) ; for ( int i = 0 ; i < size ; i ++ ) { DataPoint p = points . get ( i ) ; if ( p . x > viewportRect . left && p . x < viewportRect . right ) { int length = xRangePoints . length ; if ( length < pointsCountWithinXRange * 2 + 2 ) { xRangePoints = new float [ Math . round ( length * 3 / 2 ) ] ; } xRangePoints [ pointsCountWithinXRange * 2 + 0 ] = p . x ; xRangePoints [ pointsCountWithinXRange * 2 + 1 ] = p . y ; pointsCountWithinXRange ++ ; } } } }
compute points within horizontal x range . if point ' s y value is out of viewportrect top / bottom range but x within left / right range - point will be added to xrange array
