@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;
  }
  if (!getItemLineVisible(row,column) && !getItemShapeVisible(row,column)) {
    return;
  }
  Number v=dataset.getValue(row,column);
  if (v == null) {
    return;
  }
  int visibleRow=state.getVisibleSeriesIndex(row);
  if (visibleRow < 0) {
    return;
  }
  int visibleRowCount=state.getVisibleSeriesCount();
  PlotOrientation orientation=plot.getOrientation();
  double x1;
  if (this.useSeriesOffset) {
    x1=domainAxis.getCategorySeriesMiddle(column,dataset.getColumnCount(),visibleRow,visibleRowCount,this.itemMargin,dataArea,plot.getDomainAxisEdge());
  }
 else {
    x1=domainAxis.getCategoryMiddle(column,getColumnCount(),dataArea,plot.getDomainAxisEdge());
  }
  double value=v.doubleValue();
  double y1=rangeAxis.valueToJava2D(value,dataArea,plot.getRangeAxisEdge());
  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;
        if (this.useSeriesOffset) {
          x0=domainAxis.getCategorySeriesMiddle(column - 1,dataset.getColumnCount(),visibleRow,visibleRowCount,this.itemMargin,dataArea,plot.getDomainAxisEdge());
        }
 else {
          x0=domainAxis.getCategoryMiddle(column - 1,getColumnCount(),dataArea,plot.getDomainAxisEdge());
        }
        double y0=rangeAxis.valueToJava2D(previous,dataArea,plot.getRangeAxisEdge());
        Line2D line=null;
        if (orientation == PlotOrientation.HORIZONTAL) {
          line=new Line2D.Double(y0,x0,y1,x1);
        }
 else         if (orientation == PlotOrientation.VERTICAL) {
          line=new Line2D.Double(x0,y0,x1,y1);
        }
        g2.setPaint(getItemPaint(row,column));
        g2.setStroke(getItemStroke(row,column));
        g2.draw(line);
      }
    }
  }
  if (pass == 1) {
    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 (getItemShapeVisible(row,column)) {
      if (getItemShapeFilled(row,column)) {
        if (this.useFillPaint) {
          g2.setPaint(getItemFillPaint(row,column));
        }
 else {
          g2.setPaint(getItemPaint(row,column));
        }
        g2.fill(shape);
      }
      if (this.drawOutlines) {
        if (this.useOutlinePaint) {
          g2.setPaint(getItemOutlinePaint(row,column));
        }
 else {
          g2.setPaint(getItemPaint(row,column));
        }
        g2.setStroke(getItemOutlineStroke(row,column));
        g2.draw(shape);
      }
    }
    if (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));
      }
    }
    int datasetIndex=plot.indexOf(dataset);
    updateCrosshairValues(state.getCrosshairState(),dataset.getRowKey(row),dataset.getColumnKey(column),value,datasetIndex,x1,y1,orientation);
    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 ; } if ( ! getItemLineVisible ( row , column ) && ! getItemShapeVisible ( row , column ) ) { return ; } Number v = dataset . getValue ( row , column ) ; if ( v == null ) { return ; } int visibleRow = state . getVisibleSeriesIndex ( row ) ; if ( visibleRow < 0 ) { return ; } int visibleRowCount = state . getVisibleSeriesCount ( ) ; PlotOrientation orientation = plot . getOrientation ( ) ; double x1 ; if ( this . useSeriesOffset ) { x1 = domainAxis . getCategorySeriesMiddle ( column , dataset . getColumnCount ( ) , visibleRow , visibleRowCount , this . itemMargin , dataArea , plot . getDomainAxisEdge ( ) ) ; } else { x1 = domainAxis . getCategoryMiddle ( column , getColumnCount ( ) , dataArea , plot . getDomainAxisEdge ( ) ) ; } double value = v . doubleValue ( ) ; double y1 = rangeAxis . valueToJava2D ( value , dataArea , plot . getRangeAxisEdge ( ) ) ; 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 ; if ( this . useSeriesOffset ) { x0 = domainAxis . getCategorySeriesMiddle ( column - 1 , dataset . getColumnCount ( ) , visibleRow , visibleRowCount , this . itemMargin , dataArea , plot . getDomainAxisEdge ( ) ) ; } else { x0 = domainAxis . getCategoryMiddle ( column - 1 , getColumnCount ( ) , dataArea , plot . getDomainAxisEdge ( ) ) ; } double y0 = rangeAxis . valueToJava2D ( previous , dataArea , plot . getRangeAxisEdge ( ) ) ; Line2D line = null ; if ( orientation == PlotOrientation . HORIZONTAL ) { line = new Line2D . Double ( y0 , x0 , y1 , x1 ) ; } else if ( orientation == PlotOrientation . VERTICAL ) { line = new Line2D . Double ( x0 , y0 , x1 , y1 ) ; } g2 . setPaint ( getItemPaint ( row , column ) ) ; g2 . setStroke ( getItemStroke ( row , column ) ) ; g2 . draw ( line ) ; } } } if ( pass == 1 ) { 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 ( getItemShapeVisible ( row , column ) ) { if ( getItemShapeFilled ( row , column ) ) { if ( this . useFillPaint ) { g2 . setPaint ( getItemFillPaint ( row , column ) ) ; } else { g2 . setPaint ( getItemPaint ( row , column ) ) ; } g2 . fill ( shape ) ; } if ( this . drawOutlines ) { if ( this . useOutlinePaint ) { g2 . setPaint ( getItemOutlinePaint ( row , column ) ) ; } else { g2 . setPaint ( getItemPaint ( row , column ) ) ; } g2 . setStroke ( getItemOutlineStroke ( row , column ) ) ; g2 . draw ( shape ) ; } } if ( 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 ) ) ; } } int datasetIndex = plot . indexOf ( dataset ) ; updateCrosshairValues ( state . getCrosshairState ( ) , dataset . getRowKey ( row ) , dataset . getColumnKey ( column ) , value , datasetIndex , x1 , y1 , orientation ) ; EntityCollection entities = state . getEntityCollection ( ) ; if ( entities != null ) { addItemEntity ( entities , dataset , row , column , shape ) ; } } }
draw a single data item .
