@Override public void drawItem(Graphics2D g2,CategoryItemRendererState state,Rectangle2D dataArea,CategoryPlot plot,CategoryAxis domainAxis,ValueAxis rangeAxis,CategoryDataset dataset,int row,int column,int pass){
  if (!getItemVisible(row,column)) {
    return;
  }
  Number v=dataset.getValue(row,column);
  if (v == null) {
    return;
  }
  Rectangle2D adjusted=new Rectangle2D.Double(dataArea.getX(),dataArea.getY() + getYOffset(),dataArea.getWidth() - getXOffset(),dataArea.getHeight() - getYOffset());
  PlotOrientation orientation=plot.getOrientation();
  double x1=domainAxis.getCategoryMiddle(column,getColumnCount(),adjusted,plot.getDomainAxisEdge());
  double value=v.doubleValue();
  double y1=rangeAxis.valueToJava2D(value,adjusted,plot.getRangeAxisEdge());
  Shape shape=getItemShape(row,column);
  if (orientation == PlotOrientation.HORIZONTAL) {
    shape=ShapeUtilities.createTranslatedShape(shape,y1,x1);
  }
 else   if (orientation == PlotOrientation.VERTICAL) {
    shape=ShapeUtilities.createTranslatedShape(shape,x1,y1);
  }
  if (pass == 0 && getItemLineVisible(row,column)) {
    if (column != 0) {
      Number previousValue=dataset.getValue(row,column - 1);
      if (previousValue != null) {
        double previous=previousValue.doubleValue();
        double x0=domainAxis.getCategoryMiddle(column - 1,getColumnCount(),adjusted,plot.getDomainAxisEdge());
        double y0=rangeAxis.valueToJava2D(previous,adjusted,plot.getRangeAxisEdge());
        double x2=x0 + getXOffset();
        double y2=y0 - getYOffset();
        double x3=x1 + getXOffset();
        double y3=y1 - getYOffset();
        GeneralPath clip=new GeneralPath();
        if (orientation == PlotOrientation.HORIZONTAL) {
          clip.moveTo((float)y0,(float)x0);
          clip.lineTo((float)y1,(float)x1);
          clip.lineTo((float)y3,(float)x3);
          clip.lineTo((float)y2,(float)x2);
          clip.lineTo((float)y0,(float)x0);
          clip.closePath();
        }
 else         if (orientation == PlotOrientation.VERTICAL) {
          clip.moveTo((float)x0,(float)y0);
          clip.lineTo((float)x1,(float)y1);
          clip.lineTo((float)x3,(float)y3);
          clip.lineTo((float)x2,(float)y2);
          clip.lineTo((float)x0,(float)y0);
          clip.closePath();
        }
        g2.setPaint(getItemPaint(row,column));
        g2.fill(clip);
        g2.setStroke(getItemOutlineStroke(row,column));
        g2.setPaint(getItemOutlinePaint(row,column));
        g2.draw(clip);
      }
    }
  }
  if (pass == 1 && isItemLabelVisible(row,column)) {
    if (orientation == PlotOrientation.HORIZONTAL) {
      drawItemLabel(g2,orientation,dataset,row,column,y1,x1,(value < 0.0));
    }
 else     if (orientation == PlotOrientation.VERTICAL) {
      drawItemLabel(g2,orientation,dataset,row,column,x1,y1,(value < 0.0));
    }
  }
  EntityCollection entities=state.getEntityCollection();
  if (entities != null) {
    addItemEntity(entities,dataset,row,column,shape);
  }
}

@ Override public void drawItem ( Graphics2D g2 , CategoryItemRendererState state , Rectangle2D dataArea , CategoryPlot plot , CategoryAxis domainAxis , ValueAxis rangeAxis , CategoryDataset dataset , int row , int column , int pass ) { if ( ! getItemVisible ( row , column ) ) { return ; } Number v = dataset . getValue ( row , column ) ; if ( v == null ) { return ; } Rectangle2D adjusted = new Rectangle2D . Double ( dataArea . getX ( ) , dataArea . getY ( ) + getYOffset ( ) , dataArea . getWidth ( ) - getXOffset ( ) , dataArea . getHeight ( ) - getYOffset ( ) ) ; PlotOrientation orientation = plot . getOrientation ( ) ; double x1 = domainAxis . getCategoryMiddle ( column , getColumnCount ( ) , adjusted , plot . getDomainAxisEdge ( ) ) ; double value = v . doubleValue ( ) ; double y1 = rangeAxis . valueToJava2D ( value , adjusted , plot . getRangeAxisEdge ( ) ) ; Shape shape = getItemShape ( row , column ) ; if ( orientation == PlotOrientation . HORIZONTAL ) { shape = ShapeUtilities . createTranslatedShape ( shape , y1 , x1 ) ; } else if ( orientation == PlotOrientation . VERTICAL ) { shape = ShapeUtilities . createTranslatedShape ( shape , x1 , y1 ) ; } if ( pass == 0 && getItemLineVisible ( row , column ) ) { if ( column != 0 ) { Number previousValue = dataset . getValue ( row , column - 1 ) ; if ( previousValue != null ) { double previous = previousValue . doubleValue ( ) ; double x0 = domainAxis . getCategoryMiddle ( column - 1 , getColumnCount ( ) , adjusted , plot . getDomainAxisEdge ( ) ) ; double y0 = rangeAxis . valueToJava2D ( previous , adjusted , plot . getRangeAxisEdge ( ) ) ; double x2 = x0 + getXOffset ( ) ; double y2 = y0 - getYOffset ( ) ; double x3 = x1 + getXOffset ( ) ; double y3 = y1 - getYOffset ( ) ; GeneralPath clip = new GeneralPath ( ) ; if ( orientation == PlotOrientation . HORIZONTAL ) { clip . moveTo ( ( float ) y0 , ( float ) x0 ) ; clip . lineTo ( ( float ) y1 , ( float ) x1 ) ; clip . lineTo ( ( float ) y3 , ( float ) x3 ) ; clip . lineTo ( ( float ) y2 , ( float ) x2 ) ; clip . lineTo ( ( float ) y0 , ( float ) x0 ) ; clip . closePath ( ) ; } else if ( orientation == PlotOrientation . VERTICAL ) { clip . moveTo ( ( float ) x0 , ( float ) y0 ) ; clip . lineTo ( ( float ) x1 , ( float ) y1 ) ; clip . lineTo ( ( float ) x3 , ( float ) y3 ) ; clip . lineTo ( ( float ) x2 , ( float ) y2 ) ; clip . lineTo ( ( float ) x0 , ( float ) y0 ) ; clip . closePath ( ) ; } g2 . setPaint ( getItemPaint ( row , column ) ) ; g2 . fill ( clip ) ; g2 . setStroke ( getItemOutlineStroke ( row , column ) ) ; g2 . setPaint ( getItemOutlinePaint ( row , column ) ) ; g2 . draw ( clip ) ; } } } if ( pass == 1 && isItemLabelVisible ( row , column ) ) { if ( orientation == PlotOrientation . HORIZONTAL ) { drawItemLabel ( g2 , orientation , dataset , row , column , y1 , x1 , ( value < 0.0 ) ) ; } else if ( orientation == PlotOrientation . VERTICAL ) { drawItemLabel ( g2 , orientation , dataset , row , column , x1 , y1 , ( value < 0.0 ) ) ; } } EntityCollection entities = state . getEntityCollection ( ) ; if ( entities != null ) { addItemEntity ( entities , dataset , row , column , shape ) ; } }
draw a single data item .
