@Override public void drawItem(Graphics2D g2,XYItemRendererState state,Rectangle2D dataArea,PlotRenderingInfo info,XYPlot plot,ValueAxis domainAxis,ValueAxis rangeAxis,XYDataset dataset,int series,int item,CrosshairState crosshairState,int pass){
  if (pass == 0 && dataset instanceof IntervalXYDataset && getItemVisible(series,item)) {
    IntervalXYDataset ixyd=(IntervalXYDataset)dataset;
    PlotOrientation orientation=plot.getOrientation();
    if (this.drawXError) {
      double x0=ixyd.getStartXValue(series,item);
      double x1=ixyd.getEndXValue(series,item);
      double y=ixyd.getYValue(series,item);
      RectangleEdge edge=plot.getDomainAxisEdge();
      double xx0=domainAxis.valueToJava2D(x0,dataArea,edge);
      double xx1=domainAxis.valueToJava2D(x1,dataArea,edge);
      double yy=rangeAxis.valueToJava2D(y,dataArea,plot.getRangeAxisEdge());
      Line2D line;
      Line2D cap1;
      Line2D cap2;
      double adj=this.capLength / 2.0;
      if (orientation == PlotOrientation.VERTICAL) {
        line=new Line2D.Double(xx0,yy,xx1,yy);
        cap1=new Line2D.Double(xx0,yy - adj,xx0,yy + adj);
        cap2=new Line2D.Double(xx1,yy - adj,xx1,yy + adj);
      }
 else {
        line=new Line2D.Double(yy,xx0,yy,xx1);
        cap1=new Line2D.Double(yy - adj,xx0,yy + adj,xx0);
        cap2=new Line2D.Double(yy - adj,xx1,yy + adj,xx1);
      }
      if (this.errorPaint != null) {
        g2.setPaint(this.errorPaint);
      }
 else {
        g2.setPaint(getItemPaint(series,item));
      }
      if (this.errorStroke != null) {
        g2.setStroke(this.errorStroke);
      }
 else {
        g2.setStroke(getItemStroke(series,item));
      }
      g2.draw(line);
      g2.draw(cap1);
      g2.draw(cap2);
    }
    if (this.drawYError) {
      double y0=ixyd.getStartYValue(series,item);
      double y1=ixyd.getEndYValue(series,item);
      double x=ixyd.getXValue(series,item);
      RectangleEdge edge=plot.getRangeAxisEdge();
      double yy0=rangeAxis.valueToJava2D(y0,dataArea,edge);
      double yy1=rangeAxis.valueToJava2D(y1,dataArea,edge);
      double xx=domainAxis.valueToJava2D(x,dataArea,plot.getDomainAxisEdge());
      Line2D line;
      Line2D cap1;
      Line2D cap2;
      double adj=this.capLength / 2.0;
      if (orientation == PlotOrientation.VERTICAL) {
        line=new Line2D.Double(xx,yy0,xx,yy1);
        cap1=new Line2D.Double(xx - adj,yy0,xx + adj,yy0);
        cap2=new Line2D.Double(xx - adj,yy1,xx + adj,yy1);
      }
 else {
        line=new Line2D.Double(yy0,xx,yy1,xx);
        cap1=new Line2D.Double(yy0,xx - adj,yy0,xx + adj);
        cap2=new Line2D.Double(yy1,xx - adj,yy1,xx + adj);
      }
      if (this.errorPaint != null) {
        g2.setPaint(this.errorPaint);
      }
 else {
        g2.setPaint(getItemPaint(series,item));
      }
      if (this.errorStroke != null) {
        g2.setStroke(this.errorStroke);
      }
 else {
        g2.setStroke(getItemStroke(series,item));
      }
      g2.draw(line);
      g2.draw(cap1);
      g2.draw(cap2);
    }
  }
  super.drawItem(g2,state,dataArea,info,plot,domainAxis,rangeAxis,dataset,series,item,crosshairState,pass);
}

@ Override public void drawItem ( Graphics2D g2 , XYItemRendererState state , Rectangle2D dataArea , PlotRenderingInfo info , XYPlot plot , ValueAxis domainAxis , ValueAxis rangeAxis , XYDataset dataset , int series , int item , CrosshairState crosshairState , int pass ) { if ( pass == 0 && dataset instanceof IntervalXYDataset && getItemVisible ( series , item ) ) { IntervalXYDataset ixyd = ( IntervalXYDataset ) dataset ; PlotOrientation orientation = plot . getOrientation ( ) ; if ( this . drawXError ) { double x0 = ixyd . getStartXValue ( series , item ) ; double x1 = ixyd . getEndXValue ( series , item ) ; double y = ixyd . getYValue ( series , item ) ; RectangleEdge edge = plot . getDomainAxisEdge ( ) ; double xx0 = domainAxis . valueToJava2D ( x0 , dataArea , edge ) ; double xx1 = domainAxis . valueToJava2D ( x1 , dataArea , edge ) ; double yy = rangeAxis . valueToJava2D ( y , dataArea , plot . getRangeAxisEdge ( ) ) ; Line2D line ; Line2D cap1 ; Line2D cap2 ; double adj = this . capLength / 2.0 ; if ( orientation == PlotOrientation . VERTICAL ) { line = new Line2D . Double ( xx0 , yy , xx1 , yy ) ; cap1 = new Line2D . Double ( xx0 , yy - adj , xx0 , yy + adj ) ; cap2 = new Line2D . Double ( xx1 , yy - adj , xx1 , yy + adj ) ; } else { line = new Line2D . Double ( yy , xx0 , yy , xx1 ) ; cap1 = new Line2D . Double ( yy - adj , xx0 , yy + adj , xx0 ) ; cap2 = new Line2D . Double ( yy - adj , xx1 , yy + adj , xx1 ) ; } if ( this . errorPaint != null ) { g2 . setPaint ( this . errorPaint ) ; } else { g2 . setPaint ( getItemPaint ( series , item ) ) ; } if ( this . errorStroke != null ) { g2 . setStroke ( this . errorStroke ) ; } else { g2 . setStroke ( getItemStroke ( series , item ) ) ; } g2 . draw ( line ) ; g2 . draw ( cap1 ) ; g2 . draw ( cap2 ) ; } if ( this . drawYError ) { double y0 = ixyd . getStartYValue ( series , item ) ; double y1 = ixyd . getEndYValue ( series , item ) ; double x = ixyd . getXValue ( series , item ) ; RectangleEdge edge = plot . getRangeAxisEdge ( ) ; double yy0 = rangeAxis . valueToJava2D ( y0 , dataArea , edge ) ; double yy1 = rangeAxis . valueToJava2D ( y1 , dataArea , edge ) ; double xx = domainAxis . valueToJava2D ( x , dataArea , plot . getDomainAxisEdge ( ) ) ; Line2D line ; Line2D cap1 ; Line2D cap2 ; double adj = this . capLength / 2.0 ; if ( orientation == PlotOrientation . VERTICAL ) { line = new Line2D . Double ( xx , yy0 , xx , yy1 ) ; cap1 = new Line2D . Double ( xx - adj , yy0 , xx + adj , yy0 ) ; cap2 = new Line2D . Double ( xx - adj , yy1 , xx + adj , yy1 ) ; } else { line = new Line2D . Double ( yy0 , xx , yy1 , xx ) ; cap1 = new Line2D . Double ( yy0 , xx - adj , yy0 , xx + adj ) ; cap2 = new Line2D . Double ( yy1 , xx - adj , yy1 , xx + adj ) ; } if ( this . errorPaint != null ) { g2 . setPaint ( this . errorPaint ) ; } else { g2 . setPaint ( getItemPaint ( series , item ) ) ; } if ( this . errorStroke != null ) { g2 . setStroke ( this . errorStroke ) ; } else { g2 . setStroke ( getItemStroke ( series , item ) ) ; } g2 . draw ( line ) ; g2 . draw ( cap1 ) ; g2 . draw ( cap2 ) ; } } super . drawItem ( g2 , state , dataArea , info , plot , domainAxis , rangeAxis , dataset , series , item , crosshairState , pass ) ; }
draws the visual representation for one data item .
