@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 value=dataset.getValue(row,column);
  if (value == null) {
    return;
  }
  PlotOrientation orientation=plot.getOrientation();
  double x1s=domainAxis.getCategoryStart(column,getColumnCount(),dataArea,plot.getDomainAxisEdge());
  double x1=domainAxis.getCategoryMiddle(column,getColumnCount(),dataArea,plot.getDomainAxisEdge());
  double x1e=2 * x1 - x1s;
  double y1=rangeAxis.valueToJava2D(value.doubleValue(),dataArea,plot.getRangeAxisEdge());
  g2.setPaint(getItemPaint(row,column));
  g2.setStroke(getItemStroke(row,column));
  if (column != 0) {
    Number previousValue=dataset.getValue(row,column - 1);
    if (previousValue != null) {
      double previous=previousValue.doubleValue();
      double x0s=domainAxis.getCategoryStart(column - 1,getColumnCount(),dataArea,plot.getDomainAxisEdge());
      double x0=domainAxis.getCategoryMiddle(column - 1,getColumnCount(),dataArea,plot.getDomainAxisEdge());
      double x0e=2 * x0 - x0s;
      double y0=rangeAxis.valueToJava2D(previous,dataArea,plot.getRangeAxisEdge());
      if (getStagger()) {
        int xStagger=row * STAGGER_WIDTH;
        if (xStagger > (x1s - x0e)) {
          xStagger=(int)(x1s - x0e);
        }
        x1s=x0e + xStagger;
      }
      drawLine(g2,(State)state,orientation,x0e,y0,x1s,y0);
      drawLine(g2,(State)state,orientation,x1s,y0,x1s,y1);
    }
  }
  drawLine(g2,(State)state,orientation,x1s,y1,x1e,y1);
  if (isItemLabelVisible(row,column)) {
    drawItemLabel(g2,orientation,dataset,row,column,x1,y1,(value.doubleValue() < 0.0));
  }
  EntityCollection entities=state.getEntityCollection();
  if (entities != null) {
    Rectangle2D hotspot=new Rectangle2D.Double();
    if (orientation == PlotOrientation.VERTICAL) {
      hotspot.setRect(x1s,y1,x1e - x1s,4.0);
    }
 else {
      hotspot.setRect(y1 - 2.0,x1s,4.0,x1e - x1s);
    }
    addItemEntity(entities,dataset,row,column,hotspot);
  }
}

@ 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 value = dataset . getValue ( row , column ) ; if ( value == null ) { return ; } PlotOrientation orientation = plot . getOrientation ( ) ; double x1s = domainAxis . getCategoryStart ( column , getColumnCount ( ) , dataArea , plot . getDomainAxisEdge ( ) ) ; double x1 = domainAxis . getCategoryMiddle ( column , getColumnCount ( ) , dataArea , plot . getDomainAxisEdge ( ) ) ; double x1e = 2 * x1 - x1s ; double y1 = rangeAxis . valueToJava2D ( value . doubleValue ( ) , dataArea , plot . getRangeAxisEdge ( ) ) ; g2 . setPaint ( getItemPaint ( row , column ) ) ; g2 . setStroke ( getItemStroke ( row , column ) ) ; if ( column != 0 ) { Number previousValue = dataset . getValue ( row , column - 1 ) ; if ( previousValue != null ) { double previous = previousValue . doubleValue ( ) ; double x0s = domainAxis . getCategoryStart ( column - 1 , getColumnCount ( ) , dataArea , plot . getDomainAxisEdge ( ) ) ; double x0 = domainAxis . getCategoryMiddle ( column - 1 , getColumnCount ( ) , dataArea , plot . getDomainAxisEdge ( ) ) ; double x0e = 2 * x0 - x0s ; double y0 = rangeAxis . valueToJava2D ( previous , dataArea , plot . getRangeAxisEdge ( ) ) ; if ( getStagger ( ) ) { int xStagger = row * STAGGER_WIDTH ; if ( xStagger > ( x1s - x0e ) ) { xStagger = ( int ) ( x1s - x0e ) ; } x1s = x0e + xStagger ; } drawLine ( g2 , ( State ) state , orientation , x0e , y0 , x1s , y0 ) ; drawLine ( g2 , ( State ) state , orientation , x1s , y0 , x1s , y1 ) ; } } drawLine ( g2 , ( State ) state , orientation , x1s , y1 , x1e , y1 ) ; if ( isItemLabelVisible ( row , column ) ) { drawItemLabel ( g2 , orientation , dataset , row , column , x1 , y1 , ( value . doubleValue ( ) < 0.0 ) ) ; } EntityCollection entities = state . getEntityCollection ( ) ; if ( entities != null ) { Rectangle2D hotspot = new Rectangle2D . Double ( ) ; if ( orientation == PlotOrientation . VERTICAL ) { hotspot . setRect ( x1s , y1 , x1e - x1s , 4.0 ) ; } else { hotspot . setRect ( y1 - 2.0 , x1s , 4.0 , x1e - x1s ) ; } addItemEntity ( entities , dataset , row , column , hotspot ) ; } }
draw a single data item .
