@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 (row < dataset.getRowCount() - 1) {
    return;
  }
  Comparable category=dataset.getColumnKey(column);
  List values=createStackedValueList(dataset,dataset.getColumnKey(column),state.getVisibleSeriesArray(),getBase(),this.renderAsPercentages);
  Rectangle2D adjusted=new Rectangle2D.Double(dataArea.getX(),dataArea.getY() + getYOffset(),dataArea.getWidth() - getXOffset(),dataArea.getHeight() - getYOffset());
  PlotOrientation orientation=plot.getOrientation();
  if (orientation == PlotOrientation.HORIZONTAL) {
    drawStackHorizontal(values,category,g2,state,adjusted,plot,domainAxis,rangeAxis,dataset);
  }
 else {
    drawStackVertical(values,category,g2,state,adjusted,plot,domainAxis,rangeAxis,dataset);
  }
}

@ 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 ( row < dataset . getRowCount ( ) - 1 ) { return ; } Comparable category = dataset . getColumnKey ( column ) ; List values = createStackedValueList ( dataset , dataset . getColumnKey ( column ) , state . getVisibleSeriesArray ( ) , getBase ( ) , this . renderAsPercentages ) ; Rectangle2D adjusted = new Rectangle2D . Double ( dataArea . getX ( ) , dataArea . getY ( ) + getYOffset ( ) , dataArea . getWidth ( ) - getXOffset ( ) , dataArea . getHeight ( ) - getYOffset ( ) ) ; PlotOrientation orientation = plot . getOrientation ( ) ; if ( orientation == PlotOrientation . HORIZONTAL ) { drawStackHorizontal ( values , category , g2 , state , adjusted , plot , domainAxis , rangeAxis , dataset ) ; } else { drawStackVertical ( values , category , g2 , state , adjusted , plot , domainAxis , rangeAxis , dataset ) ; } }
draws the visual representation of one data item from the chart ( in fact , this method does nothing until it reaches the last item for each category , at which point it draws all the items for that category ) .
