@Override public void drawItem(Graphics2D g2,CategoryItemRendererState state,Rectangle2D dataArea,CategoryPlot plot,CategoryAxis domainAxis,ValueAxis rangeAxis,CategoryDataset dataset,int row,int column,int pass){
  int visibleRow=state.getVisibleSeriesIndex(row);
  if (visibleRow < 0) {
    return;
  }
  Number dataValue=dataset.getValue(row,column);
  if (dataValue == null) {
    return;
  }
  double value=dataValue.doubleValue();
  Rectangle2D adjusted=new Rectangle2D.Double(dataArea.getX(),dataArea.getY() + getYOffset(),dataArea.getWidth() - getXOffset(),dataArea.getHeight() - getYOffset());
  PlotOrientation orientation=plot.getOrientation();
  double barW0=calculateBarW0(plot,orientation,adjusted,domainAxis,state,visibleRow,column);
  double[] barL0L1=calculateBarL0L1(value);
  if (barL0L1 == null) {
    return;
  }
  RectangleEdge edge=plot.getRangeAxisEdge();
  double transL0=rangeAxis.valueToJava2D(barL0L1[0],adjusted,edge);
  double transL1=rangeAxis.valueToJava2D(barL0L1[1],adjusted,edge);
  double barL0=Math.min(transL0,transL1);
  double barLength=Math.abs(transL1 - transL0);
  Rectangle2D bar;
  if (orientation.isHorizontal()) {
    bar=new Rectangle2D.Double(barL0,barW0,barLength,state.getBarWidth());
  }
 else {
    bar=new Rectangle2D.Double(barW0,barL0,state.getBarWidth(),barLength);
  }
  if (state.getElementHinting()) {
    beginElementGroup(g2,dataset.getRowKey(row),dataset.getColumnKey(column));
  }
  Paint itemPaint=getItemPaint(row,column);
  g2.setPaint(itemPaint);
  g2.fill(bar);
  double x0=bar.getMinX();
  double x1=x0 + getXOffset();
  double x2=bar.getMaxX();
  double x3=x2 + getXOffset();
  double y0=bar.getMinY() - getYOffset();
  double y1=bar.getMinY();
  double y2=bar.getMaxY() - getYOffset();
  double y3=bar.getMaxY();
  GeneralPath bar3dRight=null;
  GeneralPath bar3dTop;
  if (barLength > 0.0) {
    bar3dRight=new GeneralPath();
    bar3dRight.moveTo((float)x2,(float)y3);
    bar3dRight.lineTo((float)x2,(float)y1);
    bar3dRight.lineTo((float)x3,(float)y0);
    bar3dRight.lineTo((float)x3,(float)y2);
    bar3dRight.closePath();
    g2.setPaint(PaintAlpha.darker(itemPaint));
    g2.fill(bar3dRight);
  }
  bar3dTop=new GeneralPath();
  bar3dTop.moveTo((float)x0,(float)y1);
  bar3dTop.lineTo((float)x1,(float)y0);
  bar3dTop.lineTo((float)x3,(float)y0);
  bar3dTop.lineTo((float)x2,(float)y1);
  bar3dTop.closePath();
  g2.fill(bar3dTop);
  if (isDrawBarOutline() && state.getBarWidth() > BAR_OUTLINE_WIDTH_THRESHOLD) {
    g2.setStroke(getItemOutlineStroke(row,column));
    g2.setPaint(getItemOutlinePaint(row,column));
    g2.draw(bar);
    if (bar3dRight != null) {
      g2.draw(bar3dRight);
    }
    g2.draw(bar3dTop);
  }
  if (state.getElementHinting()) {
    endElementGroup(g2);
  }
  CategoryItemLabelGenerator generator=getItemLabelGenerator(row,column);
  if (generator != null && isItemLabelVisible(row,column)) {
    drawItemLabel(g2,dataset,row,column,plot,generator,bar,(value < 0.0));
  }
  EntityCollection entities=state.getEntityCollection();
  if (entities != null) {
    GeneralPath barOutline=new GeneralPath();
    barOutline.moveTo((float)x0,(float)y3);
    barOutline.lineTo((float)x0,(float)y1);
    barOutline.lineTo((float)x1,(float)y0);
    barOutline.lineTo((float)x3,(float)y0);
    barOutline.lineTo((float)x3,(float)y2);
    barOutline.lineTo((float)x2,(float)y3);
    barOutline.closePath();
    addItemEntity(entities,dataset,row,column,barOutline);
  }
}

@ Override public void drawItem ( Graphics2D g2 , CategoryItemRendererState state , Rectangle2D dataArea , CategoryPlot plot , CategoryAxis domainAxis , ValueAxis rangeAxis , CategoryDataset dataset , int row , int column , int pass ) { int visibleRow = state . getVisibleSeriesIndex ( row ) ; if ( visibleRow < 0 ) { return ; } Number dataValue = dataset . getValue ( row , column ) ; if ( dataValue == null ) { return ; } double value = dataValue . doubleValue ( ) ; Rectangle2D adjusted = new Rectangle2D . Double ( dataArea . getX ( ) , dataArea . getY ( ) + getYOffset ( ) , dataArea . getWidth ( ) - getXOffset ( ) , dataArea . getHeight ( ) - getYOffset ( ) ) ; PlotOrientation orientation = plot . getOrientation ( ) ; double barW0 = calculateBarW0 ( plot , orientation , adjusted , domainAxis , state , visibleRow , column ) ; double [ ] barL0L1 = calculateBarL0L1 ( value ) ; if ( barL0L1 == null ) { return ; } RectangleEdge edge = plot . getRangeAxisEdge ( ) ; double transL0 = rangeAxis . valueToJava2D ( barL0L1 [ 0 ] , adjusted , edge ) ; double transL1 = rangeAxis . valueToJava2D ( barL0L1 [ 1 ] , adjusted , edge ) ; double barL0 = Math . min ( transL0 , transL1 ) ; double barLength = Math . abs ( transL1 - transL0 ) ; Rectangle2D bar ; if ( orientation . isHorizontal ( ) ) { bar = new Rectangle2D . Double ( barL0 , barW0 , barLength , state . getBarWidth ( ) ) ; } else { bar = new Rectangle2D . Double ( barW0 , barL0 , state . getBarWidth ( ) , barLength ) ; } if ( state . getElementHinting ( ) ) { beginElementGroup ( g2 , dataset . getRowKey ( row ) , dataset . getColumnKey ( column ) ) ; } Paint itemPaint = getItemPaint ( row , column ) ; g2 . setPaint ( itemPaint ) ; g2 . fill ( bar ) ; double x0 = bar . getMinX ( ) ; double x1 = x0 + getXOffset ( ) ; double x2 = bar . getMaxX ( ) ; double x3 = x2 + getXOffset ( ) ; double y0 = bar . getMinY ( ) - getYOffset ( ) ; double y1 = bar . getMinY ( ) ; double y2 = bar . getMaxY ( ) - getYOffset ( ) ; double y3 = bar . getMaxY ( ) ; GeneralPath bar3dRight = null ; GeneralPath bar3dTop ; if ( barLength > 0.0 ) { bar3dRight = new GeneralPath ( ) ; bar3dRight . moveTo ( ( float ) x2 , ( float ) y3 ) ; bar3dRight . lineTo ( ( float ) x2 , ( float ) y1 ) ; bar3dRight . lineTo ( ( float ) x3 , ( float ) y0 ) ; bar3dRight . lineTo ( ( float ) x3 , ( float ) y2 ) ; bar3dRight . closePath ( ) ; g2 . setPaint ( PaintAlpha . darker ( itemPaint ) ) ; g2 . fill ( bar3dRight ) ; } bar3dTop = new GeneralPath ( ) ; bar3dTop . moveTo ( ( float ) x0 , ( float ) y1 ) ; bar3dTop . lineTo ( ( float ) x1 , ( float ) y0 ) ; bar3dTop . lineTo ( ( float ) x3 , ( float ) y0 ) ; bar3dTop . lineTo ( ( float ) x2 , ( float ) y1 ) ; bar3dTop . closePath ( ) ; g2 . fill ( bar3dTop ) ; if ( isDrawBarOutline ( ) && state . getBarWidth ( ) > BAR_OUTLINE_WIDTH_THRESHOLD ) { g2 . setStroke ( getItemOutlineStroke ( row , column ) ) ; g2 . setPaint ( getItemOutlinePaint ( row , column ) ) ; g2 . draw ( bar ) ; if ( bar3dRight != null ) { g2 . draw ( bar3dRight ) ; } g2 . draw ( bar3dTop ) ; } if ( state . getElementHinting ( ) ) { endElementGroup ( g2 ) ; } CategoryItemLabelGenerator generator = getItemLabelGenerator ( row , column ) ; if ( generator != null && isItemLabelVisible ( row , column ) ) { drawItemLabel ( g2 , dataset , row , column , plot , generator , bar , ( value < 0.0 ) ) ; } EntityCollection entities = state . getEntityCollection ( ) ; if ( entities != null ) { GeneralPath barOutline = new GeneralPath ( ) ; barOutline . moveTo ( ( float ) x0 , ( float ) y3 ) ; barOutline . lineTo ( ( float ) x0 , ( float ) y1 ) ; barOutline . lineTo ( ( float ) x1 , ( float ) y0 ) ; barOutline . lineTo ( ( float ) x3 , ( float ) y0 ) ; barOutline . lineTo ( ( float ) x3 , ( float ) y2 ) ; barOutline . lineTo ( ( float ) x2 , ( float ) y3 ) ; barOutline . closePath ( ) ; addItemEntity ( entities , dataset , row , column , barOutline ) ; } }
draws a 3d bar to represent one data item .
