Program: 68662
Project: 68662
Buggy source:
/** 
 * @param aax
 * @param dAxisStart
 * @param dAxisEnd
 * @param dBlockStart
 * @param dBlockLength
 * @throws ChartException
 * @throws IllegalArgumentException
 */
private final void updateOverlayScales(AllAxes aax,double dAxisStart,double dAxisEnd,double dBlockStart,double dBlockLength) throws ChartException, IllegalArgumentException {
  final Axis[] axa=((ChartWithAxesImpl)getModel()).getPrimaryBaseAxes();
  final Axis axPrimaryBase=axa[0];
  final Axis[] axaOrthogonal=((ChartWithAxesImpl)getModel()).getOrthogonalAxes(axPrimaryBase,false);
  IntersectionValue iv;
  AutoScale sc=null;
  OneAxis oaxOverlay=null;
  int iTickStyle, iAxisType, j, iTitleLocation;
  int iOverlayCount=aax.getOverlayCount();
  int iOrientation=aax.getOrientation();
  double dStart, dEnd, dAxisLabelsThickness;
  Label laAxisTitle;
  Series[] sea=getModel().getSeries(IConstants.ORTHOGONAL);
  Map<Series,LegendItemRenderingHints> seriesRenderingHints=rtc.getSeriesRenderers();
  for (int i=0; i < iOverlayCount; i++) {
    j=iOverlayCount - i - 1;
    oaxOverlay=aax.getOverlay(j);
    iTickStyle=oaxOverlay.getCombinedTickStyle();
    iTitleLocation=oaxOverlay.getTitlePosition();
    laAxisTitle=oaxOverlay.getTitle();
    iAxisType=getAxisType(axaOrthogonal[j]);
    sc=AutoScale.computeScale(ids,oaxOverlay,new DataSetIterator(getMinMax(axaOrthogonal[j],iAxisType),iAxisType),iAxisType,dAxisStart,dAxisEnd,rtc,AUTO,1,iMarginPercent,this);
    oaxOverlay.set(sc);
    iv=oaxOverlay.getIntersectionValue();
    dStart=sc.getStart();
    dEnd=sc.getEnd();
    sc.computeTicks(ids,oaxOverlay.getLabel(),oaxOverlay.getLabelPosition(),iOrientation,dStart,dEnd,true,null);
    if (!sc.isStepFixed()) {
      final Object[] oaMinMax=sc.getMinMax();
      while (!sc.checkFit(ids,oaxOverlay.getLabel(),oaxOverlay.getLabelPosition())) {
        if (!sc.zoomOut()) {
          break;
        }
        sc.updateAxisMinMax(oaMinMax[0],oaMinMax[1]);
        sc.computeTicks(ids,oaxOverlay.getLabel(),oaxOverlay.getLabelPosition(),iOrientation,dStart,dEnd,true,null);
      }
    }
    dAxisLabelsThickness=sc.computeAxisLabelThickness(ids,oaxOverlay.getLabel(),iOrientation);
    double[] dDecorationThickness={0,0};
    for (int t=0; t < sea.length; t++) {
      LegendItemRenderingHints lirh=seriesRenderingHints.get(sea[t]);
      if (lirh != null && lirh.getRenderer() instanceof AxesRenderer) {
        IAxesDecorator iad=((AxesRenderer)lirh.getRenderer()).getAxesDecorator(oaxOverlay);
        if (iad != null) {
          double[] thickness=iad.computeDecorationThickness(ids,oaxOverlay);
          if (thickness[0] > dDecorationThickness[0]) {
            dDecorationThickness[0]=thickness[0];
          }
          if (thickness[1] > dDecorationThickness[1]) {
            dDecorationThickness[1]=thickness[1];
          }
        }
      }
    }
    double dAxisTitleThickness=0;
    sc.resetShifts();
    if (iOrientation == VERTICAL) {
      double dX=0, dX1=0, dX2=0;
      final boolean bTicksLeft=(iTickStyle & TICK_LEFT) == TICK_LEFT;
      final boolean bTicksRight=(iTickStyle & TICK_RIGHT) == TICK_RIGHT;
      final double dAppliedYAxisPlotSpacing=dYAxisPlotSpacing;
      if (laAxisTitle.isVisible()) {
        final String sPreviousValue=laAxisTitle.getCaption().getValue();
        laAxisTitle.getCaption().setValue(rtc.externalizedMessage(sPreviousValue));
        double maxHeight=boPlot.getHeight();
        double maxWidth=boPlot.getWidth() * AXIS_TITLE_PERCENT;
        LabelLimiter lbLimit=new LabelLimiter(maxWidth,maxHeight,0);
        lbLimit.computeWrapping(ids,laAxisTitle);
        lbLimit=lbLimit.limitLabelSize(cComp,ids,laAxisTitle,EnumSet.of(LabelLimiter.Option.FIX_HEIGHT));
        dAxisTitleThickness=lbLimit.getMaxWidth();
        putLabelLimiter(oaxOverlay.getModelAxis().getTitle(),lbLimit);
        laAxisTitle.getCaption().setValue(sPreviousValue);
      }
      if (oaxOverlay.getModelAxis().isSetLabelSpan()) {
        double dFixedLabelThickness=oaxOverlay.getModelAxis().getLabelSpan() * dPointToPixel;
        double dWTotal=dBlockLength;
        if (dFixedLabelThickness < dWTotal - 2 * getTickSize()) {
          if (dAxisLabelsThickness + dAxisTitleThickness > dFixedLabelThickness) {
            oaxOverlay.setShowLabels(false);
          }
          if (dAxisTitleThickness > dFixedLabelThickness) {
            laAxisTitle.setVisible(false);
            dAxisTitleThickness=0;
          }
          dAxisLabelsThickness=dFixedLabelThickness;
        }
      }
      if (iv.getType() == IConstants.MIN) {
        dX=dBlockStart;
        dX-=dAppliedYAxisPlotSpacing;
        dX1=dX;
        dX2=dX;
        if (bTicksLeft) {
          dX1-=getTickSize();
        }
        if (oaxOverlay.getLabelPosition() == LEFT) {
          dX1-=Math.max(dAxisLabelsThickness,dDecorationThickness[0]);
          dX2+=Math.max(bTicksRight ? getTickSize() : 0,dAppliedYAxisPlotSpacing);
        }
 else         if (oaxOverlay.getLabelPosition() == RIGHT) {
          dX1-=dDecorationThickness[0];
          dX2+=Math.max((bTicksRight ? getTickSize() : 0) + dAxisLabelsThickness,dAppliedYAxisPlotSpacing);
        }
        if (iTitleLocation == LEFT) {
          dX1-=dAxisTitleThickness;
        }
 else         if (iTitleLocation == RIGHT) {
          dX2+=dAxisTitleThickness;
        }
        if (dX1 < dBlockStart) {
          final double dDelta=(dBlockStart - dX1);
          dX1=dBlockStart;
          dX+=dDelta;
          dX2+=dDelta;
        }
        dBlockStart+=(dX2 - dX1);
      }
 else       if (iv.getType() == IConstants.MAX) {
        dX=dBlockStart + dBlockLength;
        dX+=dAppliedYAxisPlotSpacing;
        dX1=dX;
        dX2=dX;
        if (bTicksRight) {
          dX2+=getTickSize();
        }
        if (oaxOverlay.getLabelPosition() == RIGHT) {
          dX2+=Math.max(dAxisLabelsThickness,dDecorationThickness[1]);
          dX1-=Math.max(bTicksLeft ? getTickSize() : 0,dAppliedYAxisPlotSpacing);
        }
 else         if (oaxOverlay.getLabelPosition() == LEFT) {
          dX1-=Math.max((bTicksLeft ? getTickSize() : 0) + dAxisLabelsThickness,dAppliedYAxisPlotSpacing);
          dX2+=dDecorationThickness[1];
        }
        if (iTitleLocation == LEFT) {
          dX1-=dAxisTitleThickness;
        }
 else         if (iTitleLocation == RIGHT) {
          dX2+=dAxisTitleThickness;
        }
        if (dX2 > dBlockStart + dBlockLength) {
          final double dDelta=dX2 - (dBlockStart + dBlockLength);
          dX2=dBlockStart + dBlockLength;
          dX-=dDelta;
          dX1-=dDelta;
        }
      }
      dBlockLength-=dX2 - dX1;
      double dDelta=0;
      if (iv.getType() == IConstants.MIN) {
        dDelta=-insCA.getLeft();
      }
 else       if (iv.getType() == IConstants.MAX) {
        dDelta=insCA.getRight();
      }
      oaxOverlay.setAxisCoordinate(dX + dDelta);
      oaxOverlay.setTitleCoordinate((iTitleLocation == LEFT) ? dX1 + dDelta - 1 : dX2 + 1 - dAxisTitleThickness + dDelta);
    }
 else     if (iOrientation == HORIZONTAL) {
      double dY=0, dY1=dY, dY2=dY;
      final boolean bTicksAbove=(iTickStyle & TICK_ABOVE) == TICK_ABOVE;
      final boolean bTicksBelow=(iTickStyle & TICK_BELOW) == TICK_BELOW;
      final double dAppliedXAxisPlotSpacing=dXAxisPlotSpacing;
      if (laAxisTitle.isVisible()) {
        final String sPreviousValue=laAxisTitle.getCaption().getValue();
        laAxisTitle.getCaption().setValue(rtc.externalizedMessage(sPreviousValue));
        double maxHeight=boPlot.getHeight() * AXIS_TITLE_PERCENT;
        double maxWidth=boPlot.getWidth();
        Label laAxisTitleV=aax.getPrimaryOrthogonal().getTitle();
        if (laAxisTitleV.isVisible()) {
          laAxisTitleV=goFactory.copyOf(laAxisTitleV);
          laAxisTitleV.getCaption().setValue(rtc.externalizedMessage(laAxisTitleV.getCaption().getValue()));
          LabelLimiter lbLimitV=new LabelLimiter(boPlot.getWidth() * AXIS_TITLE_PERCENT,boPlot.getWidth(),0);
          lbLimitV.computeWrapping(ids,laAxisTitleV);
          lbLimitV.limitLabelSize(cComp,ids,laAxisTitleV);
          maxWidth-=lbLimitV.getMaxWidth();
        }
        LabelLimiter lbLimit=new LabelLimiter(maxWidth,maxHeight,0);
        lbLimit.computeWrapping(ids,laAxisTitle);
        lbLimit=lbLimit.limitLabelSize(cComp,ids,laAxisTitle,EnumSet.of(LabelLimiter.Option.FIX_WIDTH));
        dAxisTitleThickness=lbLimit.getMaxHeight();
        putLabelLimiter(oaxOverlay.getModelAxis().getTitle(),lbLimit);
        laAxisTitle.getCaption().setValue(sPreviousValue);
      }
      if (oaxOverlay.getModelAxis().isSetLabelSpan()) {
        double dFixedLabelThickness=oaxOverlay.getModelAxis().getLabelSpan() * dPointToPixel;
        double dWTotal=dBlockLength;
        if (dFixedLabelThickness < dWTotal - 2 * getTickSize()) {
          if (dAxisLabelsThickness + dAxisTitleThickness > dFixedLabelThickness) {
            oaxOverlay.setShowLabels(false);
          }
          if (dAxisTitleThickness > dFixedLabelThickness) {
            laAxisTitle.setVisible(false);
            dAxisTitleThickness=0;
          }
          dAxisLabelsThickness=dFixedLabelThickness;
        }
      }
      if (iv.getType() == IConstants.MAX) {
        dY=dBlockStart;
        dY-=dAppliedXAxisPlotSpacing;
        dY1=dY;
        dY2=dY;
        if (bTicksAbove) {
          dY1-=getTickSize();
        }
        if (oaxOverlay.getLabelPosition() == ABOVE) {
          dY1-=Math.max(dAxisLabelsThickness,dDecorationThickness[0]);
          dY2+=Math.max(bTicksBelow ? getTickSize() : 0,dAppliedXAxisPlotSpacing);
        }
 else         if (oaxOverlay.getLabelPosition() == BELOW) {
          dY1-=dDecorationThickness[0];
          dY2+=Math.max((bTicksBelow ? getTickSize() : 0) + dAxisLabelsThickness,dAppliedXAxisPlotSpacing);
        }
        if (iTitleLocation == ABOVE) {
          dY1-=dAxisTitleThickness;
        }
 else         if (iTitleLocation == BELOW) {
          dY2+=dAxisTitleThickness;
        }
        if (dY1 < dBlockStart) {
          final double dDelta=(dBlockStart - dY1);
          dY1=dBlockStart;
          dY+=dDelta;
          dY2+=dDelta;
        }
        dBlockStart+=(dY2 - dY1);
      }
 else       if (iv.getType() == IConstants.MIN) {
        dY=dBlockStart + dBlockLength;
        dY+=dAppliedXAxisPlotSpacing;
        dY1=dY;
        dY2=dY;
        if (bTicksBelow) {
          dY2+=getTickSize();
        }
        if (oaxOverlay.getLabelPosition() == BELOW) {
          dY2+=Math.max(dAxisLabelsThickness,dDecorationThickness[1]);
          dY1-=Math.max(bTicksAbove ? getTickSize() : 0,dAppliedXAxisPlotSpacing);
        }
 else         if (oaxOverlay.getLabelPosition() == ABOVE) {
          dY1-=Math.max((bTicksAbove ? getTickSize() : 0) + dAxisLabelsThickness,dAppliedXAxisPlotSpacing);
          dY2+=dDecorationThickness[1];
        }
        if (iTitleLocation == ABOVE) {
          dY1-=dAxisTitleThickness;
        }
 else         if (iTitleLocation == BELOW) {
          dY2+=dAxisTitleThickness;
        }
        if (dY2 > dBlockStart + dBlockLength) {
          final double dDelta=dY2 - (dBlockStart + dBlockLength);
          dY2=dBlockStart + dBlockLength;
          dY-=dDelta;
          dY1-=dDelta;
        }
      }
      double dDelta=0;
      if (iv.getType() == IConstants.MAX) {
        dDelta=-insCA.getTop();
      }
 else       if (iv.getType() == IConstants.MIN) {
        dDelta=insCA.getBottom();
      }
      oaxOverlay.setAxisCoordinate(dY + dDelta);
      oaxOverlay.setTitleCoordinate((iTitleLocation == ABOVE) ? dY1 + dDelta - 1 : dY2 + 1 - dAxisTitleThickness + dDelta);
      dBlockLength-=(dY2 - dY1);
    }
  }
  aax.setBlockCordinates(dBlockStart,dBlockLength);
}

Fixed version (ground truth):
/** 
 * @param aax
 * @param dAxisStart
 * @param dAxisEnd
 * @param dBlockStart
 * @param dBlockLength
 * @throws ChartException
 * @throws IllegalArgumentException
 */
private final void updateOverlayScales(AllAxes aax,double dAxisStart,double dAxisEnd,double dBlockStart,double dBlockLength) throws ChartException, IllegalArgumentException {
  final Axis[] axa=((ChartWithAxesImpl)getModel()).getPrimaryBaseAxes();
  final Axis axPrimaryBase=axa[0];
  final Axis[] axaOrthogonal=((ChartWithAxesImpl)getModel()).getOrthogonalAxes(axPrimaryBase,false);
  IntersectionValue iv;
  AutoScale sc=null;
  OneAxis oaxOverlay=null;
  int iTickStyle, iAxisType, j, iTitleLocation;
  int iOverlayCount=aax.getOverlayCount();
  int iOrientation=aax.getOrientation();
  double dStart, dEnd, dAxisLabelsThickness;
  Label laAxisTitle;
  Series[] sea=getModel().getSeries(IConstants.ORTHOGONAL);
  Map<Series,LegendItemRenderingHints> seriesRenderingHints=rtc.getSeriesRenderers();
  for (int i=0; i < iOverlayCount; i++) {
    j=iOverlayCount - i - 1;
    oaxOverlay=aax.getOverlay(j);
    iTickStyle=oaxOverlay.getCombinedTickStyle();
    iTitleLocation=oaxOverlay.getTitlePosition();
    laAxisTitle=oaxOverlay.getTitle();
    iAxisType=getAxisType(axaOrthogonal[j]);
    sc=AutoScale.computeScale(ids,oaxOverlay,new DataSetIterator(getMinMax(axaOrthogonal[j],iAxisType),iAxisType),iAxisType,dAxisStart,dAxisEnd,rtc,AUTO,1,iMarginPercent,this);
    oaxOverlay.set(sc);
    iv=oaxOverlay.getIntersectionValue();
    dStart=sc.getStart();
    dEnd=sc.getEnd();
    sc.computeTicks(ids,oaxOverlay.getLabel(),oaxOverlay.getLabelPosition(),iOrientation,dStart,dEnd,true,null);
    if (!sc.isStepFixed()) {
      final Object[] oaMinMax=sc.getMinMax();
      while (!sc.checkFit(ids,oaxOverlay.getLabel(),oaxOverlay.getLabelPosition())) {
        if (!sc.zoomOut()) {
          break;
        }
        sc.updateAxisMinMax(oaMinMax[0],oaMinMax[1]);
        sc.computeTicks(ids,oaxOverlay.getLabel(),oaxOverlay.getLabelPosition(),iOrientation,dStart,dEnd,true,null);
      }
    }
    dAxisLabelsThickness=sc.computeAxisLabelThickness(ids,oaxOverlay.getLabel(),iOrientation);
    double[] dDecorationThickness={0,0};
    for (int t=0; t < sea.length; t++) {
      LegendItemRenderingHints lirh=seriesRenderingHints.get(sea[t]);
      if (lirh != null && lirh.getRenderer() instanceof AxesRenderer) {
        IAxesDecorator iad=((AxesRenderer)lirh.getRenderer()).getAxesDecorator(oaxOverlay);
        if (iad != null) {
          double[] thickness=iad.computeDecorationThickness(ids,oaxOverlay);
          if (thickness[0] > dDecorationThickness[0]) {
            dDecorationThickness[0]=thickness[0];
          }
          if (thickness[1] > dDecorationThickness[1]) {
            dDecorationThickness[1]=thickness[1];
          }
        }
      }
    }
    double dAxisTitleThickness=0;
    sc.resetShifts();
    if (iOrientation == VERTICAL) {
      double dX=0, dX1=0, dX2=0;
      final boolean bTicksLeft=(iTickStyle & TICK_LEFT) == TICK_LEFT;
      final boolean bTicksRight=(iTickStyle & TICK_RIGHT) == TICK_RIGHT;
      final double dAppliedYAxisPlotSpacing=dYAxisPlotSpacing;
      if (laAxisTitle.isVisible()) {
        final String sPreviousValue=laAxisTitle.getCaption().getValue();
        laAxisTitle.getCaption().setValue(rtc.externalizedMessage(sPreviousValue));
        double maxHeight=boPlot.getHeight();
        double maxWidth=boPlot.getWidth() * AXIS_TITLE_PERCENT;
        LabelLimiter lbLimit=new LabelLimiter(maxWidth,maxHeight,0);
        lbLimit.computeWrapping(ids,laAxisTitle);
        lbLimit=lbLimit.limitLabelSize(cComp,ids,laAxisTitle,EnumSet.of(LabelLimiter.Option.FIX_HEIGHT));
        dAxisTitleThickness=lbLimit.getMaxWidth();
        putLabelLimiter(oaxOverlay.getModelAxis().getTitle(),lbLimit);
        laAxisTitle.getCaption().setValue(sPreviousValue);
      }
      if (oaxOverlay.getModelAxis().isSetLabelSpan()) {
        double dFixedLabelThickness=oaxOverlay.getModelAxis().getLabelSpan() * dPointToPixel;
        double dWTotal=dBlockLength;
        if (dFixedLabelThickness < dWTotal - 2 * getTickSize()) {
          if (dAxisLabelsThickness + dAxisTitleThickness > dFixedLabelThickness) {
            oaxOverlay.setShowLabels(false);
          }
          if (dAxisTitleThickness > dFixedLabelThickness) {
            laAxisTitle.setVisible(false);
            dAxisTitleThickness=0;
          }
          dAxisLabelsThickness=dFixedLabelThickness;
        }
      }
      if (iv.getType() == IConstants.MIN) {
        dX=dBlockStart;
        dX-=dAppliedYAxisPlotSpacing;
        dX1=dX;
        dX2=dX;
        if (bTicksLeft) {
          dX1-=getTickSize();
        }
        if (oaxOverlay.getLabelPosition() == LEFT) {
          dX1-=Math.max(dAxisLabelsThickness,dDecorationThickness[0]);
          dX2+=Math.max(bTicksRight ? getTickSize() : 0,dAppliedYAxisPlotSpacing);
        }
 else         if (oaxOverlay.getLabelPosition() == RIGHT) {
          dX1-=dDecorationThickness[0];
          dX2+=Math.max((bTicksRight ? getTickSize() : 0) + dAxisLabelsThickness,dAppliedYAxisPlotSpacing);
        }
        if (iTitleLocation == LEFT) {
          dX1-=dAxisTitleThickness;
        }
 else         if (iTitleLocation == RIGHT) {
          dX2+=dAxisTitleThickness;
        }
        if (dX1 < dBlockStart) {
          final double dDelta=(dBlockStart - dX1);
          dX1=dBlockStart;
          dX+=dDelta;
          dX2+=dDelta;
        }
        dBlockStart+=(dX2 - dX1);
      }
 else       if (iv.getType() == IConstants.MAX) {
        dX=dBlockStart + dBlockLength;
        dX+=dAppliedYAxisPlotSpacing;
        dX1=dX;
        dX2=dX;
        if (bTicksRight) {
          dX2+=getTickSize();
        }
        if (oaxOverlay.getLabelPosition() == RIGHT) {
          dX2+=Math.max(dAxisLabelsThickness,dDecorationThickness[1]);
          dX1-=Math.max(bTicksLeft ? getTickSize() : 0,dAppliedYAxisPlotSpacing);
        }
 else         if (oaxOverlay.getLabelPosition() == LEFT) {
          dX1-=Math.max((bTicksLeft ? getTickSize() : 0) + dAxisLabelsThickness,dAppliedYAxisPlotSpacing);
          dX2+=dDecorationThickness[1];
        }
        if (iTitleLocation == LEFT) {
          dX1-=dAxisTitleThickness;
        }
 else         if (iTitleLocation == RIGHT) {
          dX2+=dAxisTitleThickness;
        }
        if (dX2 > dBlockStart + dBlockLength) {
          final double dDelta=dX2 - (dBlockStart + dBlockLength);
          dX2=dBlockStart + dBlockLength;
          dX-=dDelta;
          dX1-=dDelta;
        }
      }
 else {
        if (oaxOverlay.getLabelPosition() == RIGHT) {
          dX2+=Math.max(dAxisLabelsThickness,dDecorationThickness[1]);
          dX1-=Math.max(bTicksLeft ? getTickSize() : 0,dAppliedYAxisPlotSpacing);
        }
 else         if (oaxOverlay.getLabelPosition() == LEFT) {
          dX1-=Math.max((bTicksLeft ? getTickSize() : 0) + dAxisLabelsThickness,dAppliedYAxisPlotSpacing);
          dX2+=dDecorationThickness[1];
        }
        if (iTitleLocation == LEFT) {
          dX1-=dAxisTitleThickness;
        }
 else         if (iTitleLocation == RIGHT) {
          dX2+=dAxisTitleThickness;
        }
      }
      dBlockLength-=dX2 - dX1;
      double dDelta=0;
      if (iv.getType() == IConstants.MIN) {
        dDelta=-insCA.getLeft();
      }
 else       if (iv.getType() == IConstants.MAX) {
        dDelta=insCA.getRight();
      }
      oaxOverlay.setAxisCoordinate(dX + dDelta);
      oaxOverlay.setTitleCoordinate((iTitleLocation == LEFT) ? dX1 + dDelta - 1 : dX2 + 1 - dAxisTitleThickness + dDelta);
    }
 else     if (iOrientation == HORIZONTAL) {
      double dY=0, dY1=dY, dY2=dY;
      final boolean bTicksAbove=(iTickStyle & TICK_ABOVE) == TICK_ABOVE;
      final boolean bTicksBelow=(iTickStyle & TICK_BELOW) == TICK_BELOW;
      final double dAppliedXAxisPlotSpacing=dXAxisPlotSpacing;
      if (laAxisTitle.isVisible()) {
        final String sPreviousValue=laAxisTitle.getCaption().getValue();
        laAxisTitle.getCaption().setValue(rtc.externalizedMessage(sPreviousValue));
        double maxHeight=boPlot.getHeight() * AXIS_TITLE_PERCENT;
        double maxWidth=boPlot.getWidth();
        Label laAxisTitleV=aax.getPrimaryOrthogonal().getTitle();
        if (laAxisTitleV.isVisible()) {
          laAxisTitleV=goFactory.copyOf(laAxisTitleV);
          laAxisTitleV.getCaption().setValue(rtc.externalizedMessage(laAxisTitleV.getCaption().getValue()));
          LabelLimiter lbLimitV=new LabelLimiter(boPlot.getWidth() * AXIS_TITLE_PERCENT,boPlot.getWidth(),0);
          lbLimitV.computeWrapping(ids,laAxisTitleV);
          lbLimitV.limitLabelSize(cComp,ids,laAxisTitleV);
          maxWidth-=lbLimitV.getMaxWidth();
        }
        LabelLimiter lbLimit=new LabelLimiter(maxWidth,maxHeight,0);
        lbLimit.computeWrapping(ids,laAxisTitle);
        lbLimit=lbLimit.limitLabelSize(cComp,ids,laAxisTitle,EnumSet.of(LabelLimiter.Option.FIX_WIDTH));
        dAxisTitleThickness=lbLimit.getMaxHeight();
        putLabelLimiter(oaxOverlay.getModelAxis().getTitle(),lbLimit);
        laAxisTitle.getCaption().setValue(sPreviousValue);
      }
      if (oaxOverlay.getModelAxis().isSetLabelSpan()) {
        double dFixedLabelThickness=oaxOverlay.getModelAxis().getLabelSpan() * dPointToPixel;
        double dWTotal=dBlockLength;
        if (dFixedLabelThickness < dWTotal - 2 * getTickSize()) {
          if (dAxisLabelsThickness + dAxisTitleThickness > dFixedLabelThickness) {
            oaxOverlay.setShowLabels(false);
          }
          if (dAxisTitleThickness > dFixedLabelThickness) {
            laAxisTitle.setVisible(false);
            dAxisTitleThickness=0;
          }
          dAxisLabelsThickness=dFixedLabelThickness;
        }
      }
      if (iv.getType() == IConstants.MAX) {
        dY=dBlockStart;
        dY-=dAppliedXAxisPlotSpacing;
        dY1=dY;
        dY2=dY;
        if (bTicksAbove) {
          dY1-=getTickSize();
        }
        if (oaxOverlay.getLabelPosition() == ABOVE) {
          dY1-=Math.max(dAxisLabelsThickness,dDecorationThickness[0]);
          dY2+=Math.max(bTicksBelow ? getTickSize() : 0,dAppliedXAxisPlotSpacing);
        }
 else         if (oaxOverlay.getLabelPosition() == BELOW) {
          dY1-=dDecorationThickness[0];
          dY2+=Math.max((bTicksBelow ? getTickSize() : 0) + dAxisLabelsThickness,dAppliedXAxisPlotSpacing);
        }
        if (iTitleLocation == ABOVE) {
          dY1-=dAxisTitleThickness;
        }
 else         if (iTitleLocation == BELOW) {
          dY2+=dAxisTitleThickness;
        }
        if (dY1 < dBlockStart) {
          final double dDelta=(dBlockStart - dY1);
          dY1=dBlockStart;
          dY+=dDelta;
          dY2+=dDelta;
        }
        dBlockStart+=(dY2 - dY1);
      }
 else       if (iv.getType() == IConstants.MIN) {
        dY=dBlockStart + dBlockLength;
        dY+=dAppliedXAxisPlotSpacing;
        dY1=dY;
        dY2=dY;
        if (bTicksBelow) {
          dY2+=getTickSize();
        }
        if (oaxOverlay.getLabelPosition() == BELOW) {
          dY2+=Math.max(dAxisLabelsThickness,dDecorationThickness[1]);
          dY1-=Math.max(bTicksAbove ? getTickSize() : 0,dAppliedXAxisPlotSpacing);
        }
 else         if (oaxOverlay.getLabelPosition() == ABOVE) {
          dY1-=Math.max((bTicksAbove ? getTickSize() : 0) + dAxisLabelsThickness,dAppliedXAxisPlotSpacing);
          dY2+=dDecorationThickness[1];
        }
        if (iTitleLocation == ABOVE) {
          dY1-=dAxisTitleThickness;
        }
 else         if (iTitleLocation == BELOW) {
          dY2+=dAxisTitleThickness;
        }
        if (dY2 > dBlockStart + dBlockLength) {
          final double dDelta=dY2 - (dBlockStart + dBlockLength);
          dY2=dBlockStart + dBlockLength;
          dY-=dDelta;
          dY1-=dDelta;
        }
      }
 else {
        if (oaxOverlay.getLabelPosition() == BELOW) {
          dY2+=Math.max(dAxisLabelsThickness,dDecorationThickness[1]);
          dY1-=Math.max(bTicksAbove ? getTickSize() : 0,dAppliedXAxisPlotSpacing);
        }
 else         if (oaxOverlay.getLabelPosition() == ABOVE) {
          dY1-=Math.max((bTicksAbove ? getTickSize() : 0) + dAxisLabelsThickness,dAppliedXAxisPlotSpacing);
          dY2+=dDecorationThickness[1];
        }
        if (iTitleLocation == ABOVE) {
          dY1-=dAxisTitleThickness;
        }
 else         if (iTitleLocation == BELOW) {
          dY2+=dAxisTitleThickness;
        }
      }
      double dDelta=0;
      if (iv.getType() == IConstants.MAX) {
        dDelta=-insCA.getTop();
      }
 else       if (iv.getType() == IConstants.MIN) {
        dDelta=insCA.getBottom();
      }
      oaxOverlay.setAxisCoordinate(dY + dDelta);
      oaxOverlay.setTitleCoordinate((iTitleLocation == ABOVE) ? dY1 + dDelta - 1 : dY2 + 1 - dAxisTitleThickness + dDelta);
      dBlockLength-=(dY2 - dY1);
    }
  }
  aax.setBlockCordinates(dBlockStart,dBlockLength);
}