@Override public XYItemRendererState initialise(Graphics2D g2,Rectangle2D dataArea,XYPlot plot,XYDataset dataset,PlotRenderingInfo info){
  ValueAxis axis=plot.getDomainAxis();
  double x1=axis.getLowerBound();
  double x2=x1 + this.maxCandleWidthInMilliseconds;
  RectangleEdge edge=plot.getDomainAxisEdge();
  double xx1=axis.valueToJava2D(x1,dataArea,edge);
  double xx2=axis.valueToJava2D(x2,dataArea,edge);
  this.maxCandleWidth=Math.abs(xx2 - xx1);
  if (this.drawVolume) {
    OHLCDataset highLowDataset=(OHLCDataset)dataset;
    this.maxVolume=0.0;
    for (int series=0; series < highLowDataset.getSeriesCount(); series++) {
      for (int item=0; item < highLowDataset.getItemCount(series); item++) {
        double volume=highLowDataset.getVolumeValue(series,item);
        if (volume > this.maxVolume) {
          this.maxVolume=volume;
        }
      }
    }
  }
  return new XYItemRendererState(info);
}

@ Override public XYItemRendererState initialise ( Graphics2D g2 , Rectangle2D dataArea , XYPlot plot , XYDataset dataset , PlotRenderingInfo info ) { ValueAxis axis = plot . getDomainAxis ( ) ; double x1 = axis . getLowerBound ( ) ; double x2 = x1 + this . maxCandleWidthInMilliseconds ; RectangleEdge edge = plot . getDomainAxisEdge ( ) ; double xx1 = axis . valueToJava2D ( x1 , dataArea , edge ) ; double xx2 = axis . valueToJava2D ( x2 , dataArea , edge ) ; this . maxCandleWidth = Math . abs ( xx2 - xx1 ) ; if ( this . drawVolume ) { OHLCDataset highLowDataset = ( OHLCDataset ) dataset ; this . maxVolume = 0.0 ; for ( int series = 0 ; series < highLowDataset . getSeriesCount ( ) ; series ++ ) { for ( int item = 0 ; item < highLowDataset . getItemCount ( series ) ; item ++ ) { double volume = highLowDataset . getVolumeValue ( series , item ) ; if ( volume > this . maxVolume ) { this . maxVolume = volume ; } } } } return new XYItemRendererState ( info ) ; }
initialises the renderer then returns the number of ' passes ' through the data that the renderer will require ( usually just one ) . this method will be called before the first item is rendered , giving the renderer an opportunity to initialise any state information it wants to maintain . the renderer can do nothing if it chooses .
