@Override public void drawSeries(Canvas canvas,Paint paint,List<Float> points,XYSeriesRenderer renderer,float yAxisValue,int seriesIndex,int startIndex){
  float lineWidth=paint.getStrokeWidth();
  paint.setStrokeWidth(renderer.getLineWidth());
  final FillOutsideLine[] fillOutsideLine=renderer.getFillOutsideLine();
  for (  FillOutsideLine fill : fillOutsideLine) {
    if (fill.getType() != FillOutsideLine.Type.NONE) {
      paint.setColor(fill.getColor());
      List<Float> fillPoints=new ArrayList<Float>();
      int[] range=fill.getFillRange();
      if (range == null) {
        fillPoints.addAll(points);
      }
 else {
        fillPoints.addAll(points.subList(range[0] * 2,range[1] * 2));
      }
      final float referencePoint;
switch (fill.getType()) {
case BOUNDS_ALL:
        referencePoint=yAxisValue;
      break;
case BOUNDS_BELOW:
    referencePoint=yAxisValue;
  break;
case BOUNDS_ABOVE:
referencePoint=yAxisValue;
break;
case BELOW:
referencePoint=canvas.getHeight();
break;
case ABOVE:
referencePoint=0;
break;
default :
throw new RuntimeException("You have added a new type of filling but have not implemented.");
}
if (fill.getType() == FillOutsideLine.Type.BOUNDS_ABOVE || fill.getType() == FillOutsideLine.Type.BOUNDS_BELOW) {
List<Float> boundsPoints=new ArrayList<Float>();
boolean add=false;
if (fill.getType() == FillOutsideLine.Type.BOUNDS_ABOVE && fillPoints.get(1) < referencePoint || fill.getType() == FillOutsideLine.Type.BOUNDS_BELOW && fillPoints.get(1) > referencePoint) {
boundsPoints.add(fillPoints.get(0));
boundsPoints.add(fillPoints.get(1));
add=true;
}
for (int i=3; i < fillPoints.size(); i+=2) {
float prevValue=fillPoints.get(i - 2);
float value=fillPoints.get(i);
if (prevValue < referencePoint && value > referencePoint || prevValue > referencePoint && value < referencePoint) {
float prevX=fillPoints.get(i - 3);
float x=fillPoints.get(i - 1);
boundsPoints.add(prevX + (x - prevX) * (referencePoint - prevValue) / (value - prevValue));
boundsPoints.add(referencePoint);
if (fill.getType() == FillOutsideLine.Type.BOUNDS_ABOVE && value > referencePoint || fill.getType() == FillOutsideLine.Type.BOUNDS_BELOW && value < referencePoint) {
i+=2;
add=false;
}
 else {
boundsPoints.add(x);
boundsPoints.add(value);
add=true;
}
}
 else {
if (add || fill.getType() == FillOutsideLine.Type.BOUNDS_ABOVE && value < referencePoint || fill.getType() == FillOutsideLine.Type.BOUNDS_BELOW && value > referencePoint) {
boundsPoints.add(fillPoints.get(i - 1));
boundsPoints.add(value);
}
}
}
fillPoints.clear();
fillPoints.addAll(boundsPoints);
}
int length=fillPoints.size();
fillPoints.set(0,fillPoints.get(0) + 1);
fillPoints.add(fillPoints.get(length - 2));
fillPoints.add(referencePoint);
fillPoints.add(fillPoints.get(0));
fillPoints.add(fillPoints.get(length + 1));
for (int i=0; i < length + 4; i+=2) {
if (fillPoints.get(i + 1) < 0) {
fillPoints.set(i + 1,0f);
}
}
paint.setStyle(Style.FILL);
drawPath(canvas,fillPoints,paint,true);
}
}
paint.setColor(renderer.getColor());
paint.setStyle(Style.STROKE);
drawPath(canvas,points,paint,false);
paint.setStrokeWidth(lineWidth);
}

@ Override public void drawSeries ( Canvas canvas , Paint paint , List < Float > points , XYSeriesRenderer renderer , float yAxisValue , int seriesIndex , int startIndex ) { float lineWidth = paint . getStrokeWidth ( ) ; paint . setStrokeWidth ( renderer . getLineWidth ( ) ) ; final FillOutsideLine [ ] fillOutsideLine = renderer . getFillOutsideLine ( ) ; for ( FillOutsideLine fill : fillOutsideLine ) { if ( fill . getType ( ) != FillOutsideLine . Type . NONE ) { paint . setColor ( fill . getColor ( ) ) ; List < Float > fillPoints = new ArrayList < Float > ( ) ; int [ ] range = fill . getFillRange ( ) ; if ( range == null ) { fillPoints . addAll ( points ) ; } else { fillPoints . addAll ( points . subList ( range [ 0 ] * 2 , range [ 1 ] * 2 ) ) ; } final float referencePoint ; switch ( fill . getType ( ) ) { case BOUNDS_ALL : referencePoint = yAxisValue ; break ; case BOUNDS_BELOW : referencePoint = yAxisValue ; break ; case BOUNDS_ABOVE : referencePoint = yAxisValue ; break ; case BELOW : referencePoint = canvas . getHeight ( ) ; break ; case ABOVE : referencePoint = 0 ; break ; default : throw new RuntimeException ( "You have added a new type of filling but have not implemented." ) ; } if ( fill . getType ( ) == FillOutsideLine . Type . BOUNDS_ABOVE || fill . getType ( ) == FillOutsideLine . Type . BOUNDS_BELOW ) { List < Float > boundsPoints = new ArrayList < Float > ( ) ; boolean add = false ; if ( fill . getType ( ) == FillOutsideLine . Type . BOUNDS_ABOVE && fillPoints . get ( 1 ) < referencePoint || fill . getType ( ) == FillOutsideLine . Type . BOUNDS_BELOW && fillPoints . get ( 1 ) > referencePoint ) { boundsPoints . add ( fillPoints . get ( 0 ) ) ; boundsPoints . add ( fillPoints . get ( 1 ) ) ; add = true ; } for ( int i = 3 ; i < fillPoints . size ( ) ; i += 2 ) { float prevValue = fillPoints . get ( i - 2 ) ; float value = fillPoints . get ( i ) ; if ( prevValue < referencePoint && value > referencePoint || prevValue > referencePoint && value < referencePoint ) { float prevX = fillPoints . get ( i - 3 ) ; float x = fillPoints . get ( i - 1 ) ; boundsPoints . add ( prevX + ( x - prevX ) * ( referencePoint - prevValue ) / ( value - prevValue ) ) ; boundsPoints . add ( referencePoint ) ; if ( fill . getType ( ) == FillOutsideLine . Type . BOUNDS_ABOVE && value > referencePoint || fill . getType ( ) == FillOutsideLine . Type . BOUNDS_BELOW && value < referencePoint ) { i += 2 ; add = false ; } else { boundsPoints . add ( x ) ; boundsPoints . add ( value ) ; add = true ; } } else { if ( add || fill . getType ( ) == FillOutsideLine . Type . BOUNDS_ABOVE && value < referencePoint || fill . getType ( ) == FillOutsideLine . Type . BOUNDS_BELOW && value > referencePoint ) { boundsPoints . add ( fillPoints . get ( i - 1 ) ) ; boundsPoints . add ( value ) ; } } } fillPoints . clear ( ) ; fillPoints . addAll ( boundsPoints ) ; } int length = fillPoints . size ( ) ; fillPoints . set ( 0 , fillPoints . get ( 0 ) + 1 ) ; fillPoints . add ( fillPoints . get ( length - 2 ) ) ; fillPoints . add ( referencePoint ) ; fillPoints . add ( fillPoints . get ( 0 ) ) ; fillPoints . add ( fillPoints . get ( length + 1 ) ) ; for ( int i = 0 ; i < length + 4 ; i += 2 ) { if ( fillPoints . get ( i + 1 ) < 0 ) { fillPoints . set ( i + 1 , 0f ) ; } } paint . setStyle ( Style . FILL ) ; drawPath ( canvas , fillPoints , paint , true ) ; } } paint . setColor ( renderer . getColor ( ) ) ; paint . setStyle ( Style . STROKE ) ; drawPath ( canvas , points , paint , false ) ; paint . setStrokeWidth ( lineWidth ) ; }
the graphical representation of a series .
