Program: 73172
Project: 73172
Buggy source:
/** 
 * Renders the axis.
 * @throws ChartException
 */
public final void renderEachAxis() throws ChartException {
  final double dStaggeredLabelOffset=sc.computeStaggeredAxisLabelOffset(xs,la,iOrientation);
  if (!lia.isSetVisible()) {
    throw new ChartException(ChartEnginePlugin.ID,ChartException.RENDERING,"String_Node_Str",Messages.getResourceBundle(getRunTimeContext().getULocale()));
  }
  tre.setLabel(la);
  tre.setTextPosition(iLabelLocation);
  tre.setLocation(lo);
  lre.setLineAttributes(lia);
  lre.setStart(LocationImpl.create(0,0));
  lre.setEnd(LocationImpl.create(0,0));
  double dXStart=0;
  double dXEnd=0;
  double dZStart=0;
  double dZEnd=0;
  if (iDimension == IConstants.THREE_D) {
    AllAxes aax=pwa.getAxes();
    dXEnd=aax.getPrimaryBase().getScale().getEnd();
    dZEnd=aax.getAncillaryBase().getScale().getEnd();
    dXStart=aax.getPrimaryBase().getScale().getStart();
    dZStart=aax.getAncillaryBase().getScale().getStart();
    daEndPoints3D=sc.getEndPoints();
    da3D=sc.getTickCordinates();
    lo3d=Location3DImpl.create(0,0,0);
    t3dre=(Text3DRenderEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),Text3DRenderEvent.class);
    t3dre.setLabel(la);
    t3dre.setAction(Text3DRenderEvent.RENDER_TEXT_AT_LOCATION);
    t3dre.setTextPosition(iLabelLocation);
    t3dre.setLocation3D(lo3d);
    l3dre=(Line3DRenderEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),Line3DRenderEvent.class);
    l3dre.setLineAttributes(lia);
    l3dre.setStart3D(Location3DImpl.create(0,0,0));
    l3dre.setEnd3D(Location3DImpl.create(0,0,0));
  }
  if (iOrientation == IConstants.VERTICAL) {
    final ComputationContext context=new ComputationContext(true);
    context.y3d=0;
    context.dX=dLocation;
    double dZ=0;
    if (bRendering3D) {
      Location3D l3d=ax.getAxisCoordinate3D();
      context.dX=l3d.getX();
      dZ=l3d.getZ();
    }
    if (iv != null && iv.getType() == IntersectionValue.MAX && iDimension == IConstants.TWO_5_D) {
      trae.setTransform(TransformationEvent.TRANSLATE);
      trae.setTranslation(dSeriesThickness,-dSeriesThickness);
      ipr.applyTransformation(trae);
    }
    context.dTick1=((iMajorTickStyle & IConstants.TICK_LEFT) == IConstants.TICK_LEFT) ? context.dX - pwa.getTickSize() : context.dX;
    context.dTick2=((iMajorTickStyle & IConstants.TICK_RIGHT) == IConstants.TICK_RIGHT) ? context.dX + pwa.getTickSize() : context.dX;
    if ((iWhatToDraw & IConstants.AXIS) == IConstants.AXIS && lia.isVisible()) {
      if (bRenderOrthogonal3DAxis) {
        final double dStart=daEndPoints3D[0];
        final double dEnd=daEndPoints3D[1];
        l3dre.setLineAttributes(lia);
        l3dre.setStart3D(context.dX,dStart,dZ);
        l3dre.setEnd3D(context.dX,dEnd,dZ);
        dc.addLine(l3dre);
        l3dre.setStart3D(context.dX,dStart,dZEnd);
        l3dre.setEnd3D(context.dX,dEnd,dZEnd);
        dc.addLine(l3dre);
        l3dre.setStart3D(dXEnd,dStart,dZ);
        l3dre.setEnd3D(dXEnd,dEnd,dZ);
        dc.addLine(l3dre);
        if (renderer.isInteractivityEnabled()) {
          Trigger tg;
          EList elTriggers=axModel.getTriggers();
          if (!elTriggers.isEmpty()) {
            ArrayList cachedTriggers=null;
            Location3D[] loaHotspot=new Location3D[4];
            Polygon3DRenderEvent pre3d=(Polygon3DRenderEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),Polygon3DRenderEvent.class);
            loaHotspot[0]=Location3DImpl.create(context.dX - IConstants.LINE_EXPAND_DOUBLE_SIZE,dStart,dZ + IConstants.LINE_EXPAND_DOUBLE_SIZE);
            loaHotspot[1]=Location3DImpl.create(context.dX + IConstants.LINE_EXPAND_DOUBLE_SIZE,dStart,dZ - IConstants.LINE_EXPAND_DOUBLE_SIZE);
            loaHotspot[2]=Location3DImpl.create(context.dX + IConstants.LINE_EXPAND_DOUBLE_SIZE,dEnd,dZ - IConstants.LINE_EXPAND_DOUBLE_SIZE);
            loaHotspot[3]=Location3DImpl.create(context.dX - IConstants.LINE_EXPAND_DOUBLE_SIZE,dEnd,dZ + IConstants.LINE_EXPAND_DOUBLE_SIZE);
            pre3d.setPoints3D(loaHotspot);
            pre3d.setDoubleSided(true);
            if (renderer.get3DEngine().processEvent(pre3d,panningOffset.getX(),panningOffset.getY()) != null) {
              final InteractionEvent iev=(InteractionEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),InteractionEvent.class);
              cachedTriggers=new ArrayList();
              for (int t=0; t < elTriggers.size(); t++) {
                tg=TriggerImpl.copyInstance((Trigger)elTriggers.get(t));
                processTrigger(tg,StructureSource.createAxis(axModel));
                cachedTriggers.add(tg);
                iev.addTrigger(TriggerImpl.copyInstance(tg));
              }
              iev.setHotSpot(pre3d);
              ipr.enableInteraction(iev);
            }
            pre3d=(Polygon3DRenderEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),Polygon3DRenderEvent.class);
            loaHotspot=new Location3D[4];
            loaHotspot[0]=Location3DImpl.create(dXStart - IConstants.LINE_EXPAND_DOUBLE_SIZE,dStart,dZEnd + IConstants.LINE_EXPAND_DOUBLE_SIZE);
            loaHotspot[1]=Location3DImpl.create(dXStart + IConstants.LINE_EXPAND_DOUBLE_SIZE,dStart,dZEnd - IConstants.LINE_EXPAND_DOUBLE_SIZE);
            loaHotspot[2]=Location3DImpl.create(dXStart + IConstants.LINE_EXPAND_DOUBLE_SIZE,dEnd,dZEnd - IConstants.LINE_EXPAND_DOUBLE_SIZE);
            loaHotspot[3]=Location3DImpl.create(dXStart - IConstants.LINE_EXPAND_DOUBLE_SIZE,dEnd,dZEnd + IConstants.LINE_EXPAND_DOUBLE_SIZE);
            pre3d.setPoints3D(loaHotspot);
            pre3d.setDoubleSided(true);
            if (renderer.get3DEngine().processEvent(pre3d,panningOffset.getX(),panningOffset.getY()) != null) {
              final InteractionEvent iev=(InteractionEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),InteractionEvent.class);
              if (cachedTriggers == null) {
                cachedTriggers=new ArrayList();
                for (int t=0; t < elTriggers.size(); t++) {
                  tg=TriggerImpl.copyInstance((Trigger)elTriggers.get(t));
                  processTrigger(tg,StructureSource.createAxis(axModel));
                  cachedTriggers.add(tg);
                  iev.addTrigger(TriggerImpl.copyInstance(tg));
                }
              }
 else {
                for (int t=0; t < cachedTriggers.size(); t++) {
                  iev.addTrigger(TriggerImpl.copyInstance((Trigger)cachedTriggers.get(t)));
                }
              }
              iev.setHotSpot(pre3d);
              ipr.enableInteraction(iev);
            }
            pre3d=(Polygon3DRenderEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),Polygon3DRenderEvent.class);
            loaHotspot=new Location3D[4];
            loaHotspot[0]=Location3DImpl.create(dXEnd - IConstants.LINE_EXPAND_DOUBLE_SIZE,dStart,dZStart + IConstants.LINE_EXPAND_DOUBLE_SIZE);
            loaHotspot[1]=Location3DImpl.create(dXEnd + IConstants.LINE_EXPAND_DOUBLE_SIZE,dStart,dZStart - IConstants.LINE_EXPAND_DOUBLE_SIZE);
            loaHotspot[2]=Location3DImpl.create(dXEnd + IConstants.LINE_EXPAND_DOUBLE_SIZE,dEnd,dZStart - IConstants.LINE_EXPAND_DOUBLE_SIZE);
            loaHotspot[3]=Location3DImpl.create(dXEnd - IConstants.LINE_EXPAND_DOUBLE_SIZE,dEnd,dZStart + IConstants.LINE_EXPAND_DOUBLE_SIZE);
            pre3d.setPoints3D(loaHotspot);
            pre3d.setDoubleSided(true);
            if (renderer.get3DEngine().processEvent(pre3d,panningOffset.getX(),panningOffset.getY()) != null) {
              final InteractionEvent iev=(InteractionEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),InteractionEvent.class);
              if (cachedTriggers == null) {
                for (int t=0; t < elTriggers.size(); t++) {
                  tg=TriggerImpl.copyInstance((Trigger)elTriggers.get(t));
                  processTrigger(tg,StructureSource.createAxis(axModel));
                  iev.addTrigger(tg);
                }
              }
 else {
                for (int t=0; t < cachedTriggers.size(); t++) {
                  iev.addTrigger((Trigger)cachedTriggers.get(t));
                }
              }
              iev.setHotSpot(pre3d);
              ipr.enableInteraction(iev);
            }
          }
        }
      }
 else {
        double dStart=daEndPoints[0] + insCA.getBottom(), dEnd=daEndPoints[1] - insCA.getTop();
        if (sc.getDirection() == IConstants.FORWARD) {
          dStart=daEndPoints[1] + insCA.getBottom();
          dEnd=daEndPoints[0] - insCA.getTop();
        }
        if (iv != null && iv.getType() == IntersectionValue.VALUE && iDimension == IConstants.TWO_5_D) {
          final Location[] loa=new Location[4];
          loa[0]=LocationImpl.create(context.dX,dStart);
          loa[1]=LocationImpl.create(context.dX + dSeriesThickness,dStart - dSeriesThickness);
          loa[2]=LocationImpl.create(context.dX + dSeriesThickness,dEnd - dSeriesThickness);
          loa[3]=LocationImpl.create(context.dX,dEnd);
          final PolygonRenderEvent pre=(PolygonRenderEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),PolygonRenderEvent.class);
          pre.setPoints(loa);
          pre.setBackground(ColorDefinitionImpl.create(255,255,255,127));
          pre.setOutline(lia);
          ipr.fillPolygon(pre);
        }
        lre.setLineAttributes(lia);
        lre.getStart().set(context.dX,dStart);
        lre.getEnd().set(context.dX,dEnd);
        ipr.drawLine(lre);
        if (renderer.isInteractivityEnabled()) {
          Trigger tg;
          EList elTriggers=axModel.getTriggers();
          if (!elTriggers.isEmpty()) {
            final InteractionEvent iev=(InteractionEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),InteractionEvent.class);
            for (int t=0; t < elTriggers.size(); t++) {
              tg=TriggerImpl.copyInstance((Trigger)elTriggers.get(t));
              processTrigger(tg,StructureSource.createAxis(axModel));
              iev.addTrigger(tg);
            }
            Location[] loaHotspot=new Location[4];
            loaHotspot[0]=LocationImpl.create(context.dX - IConstants.LINE_EXPAND_SIZE,dStart);
            loaHotspot[1]=LocationImpl.create(context.dX + IConstants.LINE_EXPAND_SIZE,dStart);
            loaHotspot[2]=LocationImpl.create(context.dX + IConstants.LINE_EXPAND_SIZE,dEnd);
            loaHotspot[3]=LocationImpl.create(context.dX - IConstants.LINE_EXPAND_SIZE,dEnd);
            final PolygonRenderEvent pre=(PolygonRenderEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),PolygonRenderEvent.class);
            pre.setPoints(loaHotspot);
            iev.setHotSpot(pre);
            ipr.enableInteraction(iev);
          }
        }
      }
    }
    renderVerticalAxisByType(context,dXEnd,dZEnd,dZ,dStaggeredLabelOffset);
    la=LabelImpl.copyInstance(ax.getTitle());
    if (la.isVisible() && bRenderAxisTitle) {
      ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_AXIS_TITLE,axModel,la,getRunTimeContext().getScriptContext());
      getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_AXIS_TITLE,la);
      final String sRestoreValue=la.getCaption().getValue();
      la.getCaption().setValue(getRunTimeContext().externalizedMessage(sRestoreValue));
      BoundingBox bb=null;
      boolean bWithinAxis=false;
      final boolean bTitleHorizontal=Math.abs(la.getCaption().getFont().getRotation()) <= 30;
      final double dYAxisHeightPC=ChartUtil.computeHeightOfOrthogonalAxisTitle((ChartWithAxes)this.renderer.cm,xs);
      try {
        if (bTitleHorizontal) {
          bWithinAxis=true;
        }
 else {
          final BoundingBox bbWoWrap=Methods.computeBox(xs,iLabelLocation,la,0,0,dYAxisHeightPC);
          bWithinAxis=bbWoWrap.getHeight() < daEndPoints[0] - daEndPoints[1];
        }
        bb=Methods.computeBox(xs,ax.getTitlePosition(),la,0,0,bWithinAxis && !bTitleHorizontal ? daEndPoints[0] - daEndPoints[1] : dYAxisHeightPC);
      }
 catch (      IllegalArgumentException uiex) {
        throw new ChartException(ChartEnginePlugin.ID,ChartException.RENDERING,uiex);
      }
      if (ax.getTitle().isVisible() && la.isVisible()) {
        if (bRendering3D) {
          double yCenter=daEndPoints3D[0] + ((daEndPoints3D[1] - daEndPoints3D[0]) / 2);
          final double x=(iLabelLocation == IConstants.LEFT) ? context.dTick1 - 1 : context.dTick2 + 1;
          double sx=x;
          double sx2=dXEnd;
          if (bAxisLabelStaggered) {
            if (iLabelLocation == IConstants.LEFT) {
              sx-=dStaggeredLabelOffset;
              sx2+=dStaggeredLabelOffset;
            }
 else {
              sx+=dStaggeredLabelOffset;
              sx2-=dStaggeredLabelOffset;
            }
          }
          Angle3D a3D=(Angle3D)((ChartWithAxes)renderer.cm).getRotation().getAngles().get(0);
          double offset=2;
          t3dre=(Text3DRenderEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),Text3DRenderEvent.class);
          sx=sx - pwa.getHorizontalSpacingInPixels() - bb.getWidth()- bb.getHeight();
          t3dre.setLocation3D(Location3DImpl.create(sx - offset,yCenter,dZEnd + offset + pwa.getHorizontalSpacingInPixels()+ (bb.getWidth() + bb.getHeight()) * Math.sin(a3D.getYAngle() * Math.PI / 180)));
          t3dre.setLabel(la);
          t3dre.setTextPosition(Text3DRenderEvent.LEFT);
          t3dre.setAction(Text3DRenderEvent.RENDER_TEXT_AT_LOCATION);
          dc.addLabel(t3dre);
          t3dre=(Text3DRenderEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),Text3DRenderEvent.class);
          sx2=sx2 + pwa.getHorizontalSpacingInPixels() + 100;
          t3dre.setLocation3D(Location3DImpl.create(sx2,yCenter,dZ - pwa.getHorizontalSpacingInPixels() - 100 * Math.sin(a3D.getYAngle() * Math.PI / 180)));
          t3dre.setLabel(la);
          t3dre.setTextPosition(Text3DRenderEvent.RIGHT);
          t3dre.setAction(Text3DRenderEvent.RENDER_TEXT_AT_LOCATION);
          dc.addLabel(t3dre);
        }
 else {
          double dTop=computeTopOfOrthogonalAxisTitle();
          final Bounds bo=BoundsImpl.create(ax.getTitleCoordinate(),bWithinAxis ? daEndPoints[1] : dTop,bb.getWidth(),bWithinAxis ? daEndPoints[0] - daEndPoints[1] : dYAxisHeightPC);
          tre.setBlockBounds(bo);
          tre.setLabel(la);
          if (ax.getModelAxis().getAssociatedAxes().size() != 0) {
            tre.setBlockAlignment(ChartUtil.transposeAlignment(la.getCaption().getFont().getAlignment()));
          }
 else {
            tre.setBlockAlignment(la.getCaption().getFont().getAlignment());
          }
          tre.setAction(TextRenderEvent.RENDER_TEXT_IN_BLOCK);
          if (ax.getTitle().isVisible()) {
            ipr.drawText(tre);
          }
        }
      }
      la.getCaption().setValue(sRestoreValue);
      ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_AXIS_TITLE,axModel,la,getRunTimeContext().getScriptContext());
      getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_AXIS_TITLE,la);
    }
    la=LabelImpl.copyInstance(ax.getLabel());
    if (iv != null && iv.getType() == IntersectionValue.MAX && iDimension == IConstants.TWO_5_D) {
      trae.setTranslation(-dSeriesThickness,dSeriesThickness);
      ipr.applyTransformation(trae);
    }
  }
 else   if (iOrientation == IConstants.HORIZONTAL) {
    final ComputationContext context=new ComputationContext(false);
    context.x3d=0;
    context.z3d=0;
    context.dY=dLocation;
    double dX=0;
    double dZ=0;
    if (bRendering3D) {
      Location3D l3d=ax.getAxisCoordinate3D();
      dX=l3d.getX();
      context.dY=l3d.getY();
      dZ=l3d.getZ();
    }
    context.dTick1=((iMajorTickStyle & IConstants.TICK_ABOVE) == IConstants.TICK_ABOVE) ? (bRendering3D ? context.dY + pwa.getTickSize() : context.dY - pwa.getTickSize()) : context.dY;
    context.dTick2=((iMajorTickStyle & IConstants.TICK_BELOW) == IConstants.TICK_BELOW) ? (bRendering3D ? context.dY - pwa.getTickSize() : context.dY + pwa.getTickSize()) : context.dY;
    if (iv != null && iDimension == IConstants.TWO_5_D && ((bTransposed && renderer.isRightToLeft() && iv.getType() == IntersectionValue.MIN) || (!renderer.isRightToLeft() && iv.getType() == IntersectionValue.MAX))) {
      trae.setTransform(TransformationEvent.TRANSLATE);
      trae.setTranslation(dSeriesThickness,-dSeriesThickness);
      ipr.applyTransformation(trae);
    }
    if ((iWhatToDraw & IConstants.AXIS) == IConstants.AXIS && lia.isVisible()) {
      if (bRenderBase3DAxis) {
        final double dStart=daEndPoints3D[0];
        final double dEnd=daEndPoints3D[1];
        l3dre.setLineAttributes(lia);
        l3dre.setStart3D(dStart,context.dY,dZ);
        l3dre.setEnd3D(dEnd,context.dY,dZ);
        dc.addLine(l3dre);
        if (renderer.isInteractivityEnabled()) {
          Trigger tg;
          EList elTriggers=axModel.getTriggers();
          if (!elTriggers.isEmpty()) {
            final Polygon3DRenderEvent pre3d=(Polygon3DRenderEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),Polygon3DRenderEvent.class);
            Location3D[] loaHotspot=new Location3D[4];
            loaHotspot[0]=Location3DImpl.create(dStart,context.dY - IConstants.LINE_EXPAND_DOUBLE_SIZE,dZ);
            loaHotspot[1]=Location3DImpl.create(dStart,context.dY + IConstants.LINE_EXPAND_DOUBLE_SIZE,dZ);
            loaHotspot[2]=Location3DImpl.create(dEnd,context.dY + IConstants.LINE_EXPAND_DOUBLE_SIZE,dZ);
            loaHotspot[3]=Location3DImpl.create(dEnd,context.dY - IConstants.LINE_EXPAND_DOUBLE_SIZE,dZ);
            pre3d.setPoints3D(loaHotspot);
            pre3d.setDoubleSided(true);
            if (renderer.get3DEngine().processEvent(pre3d,panningOffset.getX(),panningOffset.getY()) != null) {
              final InteractionEvent iev=(InteractionEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),InteractionEvent.class);
              for (int t=0; t < elTriggers.size(); t++) {
                tg=TriggerImpl.copyInstance((Trigger)elTriggers.get(t));
                processTrigger(tg,StructureSource.createAxis(axModel));
                iev.addTrigger(tg);
              }
              iev.setHotSpot(pre3d);
              ipr.enableInteraction(iev);
            }
          }
        }
      }
 else       if (bRenderAncillary3DAxis) {
        final double dStart=daEndPoints3D[0];
        final double dEnd=daEndPoints3D[1];
        l3dre.setLineAttributes(lia);
        l3dre.setStart3D(dX,context.dY,dStart);
        l3dre.setEnd3D(dX,context.dY,dEnd);
        dc.addLine(l3dre);
        if (renderer.isInteractivityEnabled()) {
          Trigger tg;
          EList elTriggers=axModel.getTriggers();
          if (!elTriggers.isEmpty()) {
            final Polygon3DRenderEvent pre3d=(Polygon3DRenderEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),Polygon3DRenderEvent.class);
            Location3D[] loaHotspot=new Location3D[4];
            loaHotspot[0]=Location3DImpl.create(dX,context.dY - IConstants.LINE_EXPAND_DOUBLE_SIZE,dStart);
            loaHotspot[1]=Location3DImpl.create(dX,context.dY + IConstants.LINE_EXPAND_DOUBLE_SIZE,dStart);
            loaHotspot[2]=Location3DImpl.create(dX,context.dY + IConstants.LINE_EXPAND_DOUBLE_SIZE,dEnd);
            loaHotspot[3]=Location3DImpl.create(dX,context.dY - IConstants.LINE_EXPAND_DOUBLE_SIZE,dEnd);
            pre3d.setPoints3D(loaHotspot);
            pre3d.setDoubleSided(true);
            if (renderer.get3DEngine().processEvent(pre3d,panningOffset.getX(),panningOffset.getY()) != null) {
              final InteractionEvent iev=(InteractionEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),InteractionEvent.class);
              for (int t=0; t < elTriggers.size(); t++) {
                tg=TriggerImpl.copyInstance((Trigger)elTriggers.get(t));
                processTrigger(tg,StructureSource.createAxis(axModel));
                iev.addTrigger(tg);
              }
              iev.setHotSpot(pre3d);
              ipr.enableInteraction(iev);
            }
          }
        }
      }
 else {
        double dStart=daEndPoints[0] - insCA.getLeft(), dEnd=daEndPoints[1] + insCA.getRight();
        if (sc.getDirection() == IConstants.BACKWARD) {
          dStart=daEndPoints[1] - insCA.getLeft();
          dEnd=daEndPoints[0] + insCA.getRight();
        }
        if (iv != null && iv.getType() == IntersectionValue.VALUE && iDimension == IConstants.TWO_5_D) {
          final Location[] loa=new Location[4];
          loa[0]=LocationImpl.create(dStart,context.dY);
          loa[1]=LocationImpl.create(dStart + dSeriesThickness,context.dY - dSeriesThickness);
          loa[2]=LocationImpl.create(dEnd + dSeriesThickness,context.dY - dSeriesThickness);
          loa[3]=LocationImpl.create(dEnd,context.dY);
          final PolygonRenderEvent pre=(PolygonRenderEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),PolygonRenderEvent.class);
          pre.setPoints(loa);
          pre.setBackground(ColorDefinitionImpl.create(255,255,255,127));
          pre.setOutline(lia);
          ipr.fillPolygon(pre);
        }
        lre.setLineAttributes(lia);
        lre.getStart().set(dStart,context.dY);
        lre.getEnd().set(dEnd,context.dY);
        ipr.drawLine(lre);
        if (renderer.isInteractivityEnabled()) {
          Trigger tg;
          EList elTriggers=axModel.getTriggers();
          if (!elTriggers.isEmpty()) {
            final InteractionEvent iev=(InteractionEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),InteractionEvent.class);
            for (int t=0; t < elTriggers.size(); t++) {
              tg=TriggerImpl.copyInstance((Trigger)elTriggers.get(t));
              processTrigger(tg,StructureSource.createAxis(axModel));
              iev.addTrigger(tg);
            }
            Location[] loaHotspot=new Location[4];
            loaHotspot[0]=LocationImpl.create(dStart,context.dY - IConstants.LINE_EXPAND_SIZE);
            loaHotspot[1]=LocationImpl.create(dEnd,context.dY - IConstants.LINE_EXPAND_SIZE);
            loaHotspot[2]=LocationImpl.create(dEnd,context.dY + IConstants.LINE_EXPAND_SIZE);
            loaHotspot[3]=LocationImpl.create(dStart,context.dY + IConstants.LINE_EXPAND_SIZE);
            final PolygonRenderEvent pre=(PolygonRenderEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),PolygonRenderEvent.class);
            pre.setPoints(loaHotspot);
            iev.setHotSpot(pre);
            ipr.enableInteraction(iev);
          }
        }
      }
    }
    renderHorizontalAxisByType(context,dXEnd,dZEnd,dZ,dStaggeredLabelOffset);
    la=LabelImpl.copyInstance(ax.getTitle());
    if (la.isVisible() && bRenderAxisTitle) {
      ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_AXIS_TITLE,axModel,la,getRunTimeContext().getScriptContext());
      getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_AXIS_TITLE,la);
      final String sRestoreValue=la.getCaption().getValue();
      la.getCaption().setValue(getRunTimeContext().externalizedMessage(sRestoreValue));
      la.getCaption().getFont().setAlignment(renderer.switchTextAlignment(la.getCaption().getFont().getAlignment()));
      BoundingBox bb=null;
      try {
        bb=Methods.computeBox(xs,ax.getTitlePosition(),la,0,0,Math.abs(daEndPoints[1] - daEndPoints[0]));
      }
 catch (      IllegalArgumentException uiex) {
        throw new ChartException(ChartEnginePlugin.ID,ChartException.RENDERING,uiex);
      }
      if (ax.getTitle().isVisible() && la.isVisible()) {
        if (bRendering3D) {
          Angle3D a3D=(Angle3D)((ChartWithAxes)renderer.cm).getRotation().getAngles().get(0);
          if (axisType == IConstants.BASE_AXIS) {
            t3dre=(Text3DRenderEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),Text3DRenderEvent.class);
            IAxisTypeComputation computation=createAxisTypeComputation(context);
            computation.initialize();
            final int length=computation instanceof TextAxisTypeComputation ? da.size() - 1 : da.size();
            int xStart=(int)da3D.getCoordinate(0);
            int xEnd=(int)da3D.getCoordinate(length - 1);
            int x=xStart + (xEnd - xStart) / 2;
            Location3D location=Location3DImpl.create(x,context.dY - bb.getHeight() * 3,dZEnd + pwa.getVerticalSpacingInPixels());
            t3dre.setLocation3D(location);
            t3dre.setLabel(la);
            double angle=(a3D.getZAngle() + a3D.getXAngle()) % 360;
            if (angle > 0 && angle <= 180) {
              t3dre.setTextPosition(Text3DRenderEvent.RIGHT);
            }
 else {
              t3dre.setTextPosition(Text3DRenderEvent.LEFT);
            }
            t3dre.setAction(Text3DRenderEvent.RENDER_TEXT_AT_LOCATION);
            dc.addLabel(t3dre);
          }
 else {
            Location3D location=Location3DImpl.create(dXEnd,context.dY - bb.getHeight(),dZ + (dZEnd - dZ) / 2);
            t3dre.setLocation3D(location);
            t3dre.setLabel(la);
            double angle=a3D.getZAngle() % 360;
            if (angle >= 0 && angle < 180) {
              t3dre.setTextPosition(Text3DRenderEvent.RIGHT);
            }
 else {
              t3dre.setTextPosition(Text3DRenderEvent.LEFT);
            }
            t3dre.setAction(Text3DRenderEvent.RENDER_TEXT_AT_LOCATION);
            dc.addLabel(t3dre);
          }
        }
 else {
          final Bounds bo=BoundsImpl.create(daEndPoints[0],ax.getTitleCoordinate(),daEndPoints[1] - daEndPoints[0],bb.getHeight());
          tre.setBlockBounds(bo);
          tre.setLabel(la);
          if (ax.getModelAxis().getAssociatedAxes().size() != 0) {
            tre.setBlockAlignment(la.getCaption().getFont().getAlignment());
          }
 else {
            tre.setBlockAlignment(ChartUtil.transposeAlignment(la.getCaption().getFont().getAlignment()));
          }
          tre.setAction(TextRenderEvent.RENDER_TEXT_IN_BLOCK);
          ipr.drawText(tre);
        }
      }
      ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_AXIS_TITLE,axModel,la,getRunTimeContext().getScriptContext());
      getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_AXIS_TITLE,la);
    }
    la=LabelImpl.copyInstance(ax.getLabel());
    if (iv != null && iDimension == IConstants.TWO_5_D && ((bTransposed && renderer.isRightToLeft() && iv.getType() == IntersectionValue.MIN) || (!renderer.isRightToLeft() && iv.getType() == IntersectionValue.MAX))) {
      trae.setTranslation(-dSeriesThickness,dSeriesThickness);
      ipr.applyTransformation(trae);
    }
  }
}

Fixed version (ground truth):
/** 
 * Renders the axis.
 * @throws ChartException
 */
public final void renderEachAxis() throws ChartException {
  final double dStaggeredLabelOffset=sc.computeStaggeredAxisLabelOffset(xs,la,iOrientation);
  if (!lia.isSetVisible()) {
    throw new ChartException(ChartEnginePlugin.ID,ChartException.RENDERING,"String_Node_Str",Messages.getResourceBundle(getRunTimeContext().getULocale()));
  }
  tre.setLabel(la);
  tre.setTextPosition(iLabelLocation);
  tre.setLocation(lo);
  lre.setLineAttributes(lia);
  lre.setStart(LocationImpl.create(0,0));
  lre.setEnd(LocationImpl.create(0,0));
  double dXStart=0;
  double dXEnd=0;
  double dZStart=0;
  double dZEnd=0;
  if (iDimension == IConstants.THREE_D) {
    AllAxes aax=pwa.getAxes();
    dXEnd=aax.getPrimaryBase().getScale().getEnd();
    dZEnd=aax.getAncillaryBase().getScale().getEnd();
    dXStart=aax.getPrimaryBase().getScale().getStart();
    dZStart=aax.getAncillaryBase().getScale().getStart();
    daEndPoints3D=sc.getEndPoints();
    da3D=sc.getTickCordinates();
    lo3d=Location3DImpl.create(0,0,0);
    t3dre=(Text3DRenderEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),Text3DRenderEvent.class);
    t3dre.setLabel(la);
    t3dre.setAction(Text3DRenderEvent.RENDER_TEXT_AT_LOCATION);
    t3dre.setTextPosition(iLabelLocation);
    t3dre.setLocation3D(lo3d);
    l3dre=(Line3DRenderEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),Line3DRenderEvent.class);
    l3dre.setLineAttributes(lia);
    l3dre.setStart3D(Location3DImpl.create(0,0,0));
    l3dre.setEnd3D(Location3DImpl.create(0,0,0));
  }
  if (iOrientation == IConstants.VERTICAL) {
    final ComputationContext context=new ComputationContext(true);
    context.y3d=0;
    context.dX=dLocation;
    double dZ=0;
    if (bRendering3D) {
      Location3D l3d=ax.getAxisCoordinate3D();
      context.dX=l3d.getX();
      dZ=l3d.getZ();
    }
    if (iv != null && iv.getType() == IntersectionValue.MAX && iDimension == IConstants.TWO_5_D) {
      trae.setTransform(TransformationEvent.TRANSLATE);
      trae.setTranslation(dSeriesThickness,-dSeriesThickness);
      ipr.applyTransformation(trae);
    }
    context.dTick1=((iMajorTickStyle & IConstants.TICK_LEFT) == IConstants.TICK_LEFT) ? context.dX - pwa.getTickSize() : context.dX;
    context.dTick2=((iMajorTickStyle & IConstants.TICK_RIGHT) == IConstants.TICK_RIGHT) ? context.dX + pwa.getTickSize() : context.dX;
    if ((iWhatToDraw & IConstants.AXIS) == IConstants.AXIS && lia.isVisible()) {
      if (bRenderOrthogonal3DAxis) {
        final double dStart=daEndPoints3D[0];
        final double dEnd=daEndPoints3D[1];
        l3dre.setLineAttributes(lia);
        l3dre.setStart3D(context.dX,dStart,dZ);
        l3dre.setEnd3D(context.dX,dEnd,dZ);
        dc.addLine(l3dre);
        l3dre.setStart3D(context.dX,dStart,dZEnd);
        l3dre.setEnd3D(context.dX,dEnd,dZEnd);
        dc.addLine(l3dre);
        l3dre.setStart3D(dXEnd,dStart,dZ);
        l3dre.setEnd3D(dXEnd,dEnd,dZ);
        dc.addLine(l3dre);
        if (renderer.isInteractivityEnabled()) {
          Trigger tg;
          EList elTriggers=axModel.getTriggers();
          if (!elTriggers.isEmpty()) {
            ArrayList cachedTriggers=null;
            Location3D[] loaHotspot=new Location3D[4];
            Polygon3DRenderEvent pre3d=(Polygon3DRenderEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),Polygon3DRenderEvent.class);
            loaHotspot[0]=Location3DImpl.create(context.dX - IConstants.LINE_EXPAND_DOUBLE_SIZE,dStart,dZ + IConstants.LINE_EXPAND_DOUBLE_SIZE);
            loaHotspot[1]=Location3DImpl.create(context.dX + IConstants.LINE_EXPAND_DOUBLE_SIZE,dStart,dZ - IConstants.LINE_EXPAND_DOUBLE_SIZE);
            loaHotspot[2]=Location3DImpl.create(context.dX + IConstants.LINE_EXPAND_DOUBLE_SIZE,dEnd,dZ - IConstants.LINE_EXPAND_DOUBLE_SIZE);
            loaHotspot[3]=Location3DImpl.create(context.dX - IConstants.LINE_EXPAND_DOUBLE_SIZE,dEnd,dZ + IConstants.LINE_EXPAND_DOUBLE_SIZE);
            pre3d.setPoints3D(loaHotspot);
            pre3d.setDoubleSided(true);
            if (renderer.get3DEngine().processEvent(pre3d,panningOffset.getX(),panningOffset.getY()) != null) {
              final InteractionEvent iev=(InteractionEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),InteractionEvent.class);
              cachedTriggers=new ArrayList();
              for (int t=0; t < elTriggers.size(); t++) {
                tg=TriggerImpl.copyInstance((Trigger)elTriggers.get(t));
                processTrigger(tg,StructureSource.createAxis(axModel));
                cachedTriggers.add(tg);
                iev.addTrigger(TriggerImpl.copyInstance(tg));
              }
              iev.setHotSpot(pre3d);
              ipr.enableInteraction(iev);
            }
            pre3d=(Polygon3DRenderEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),Polygon3DRenderEvent.class);
            loaHotspot=new Location3D[4];
            loaHotspot[0]=Location3DImpl.create(dXStart - IConstants.LINE_EXPAND_DOUBLE_SIZE,dStart,dZEnd + IConstants.LINE_EXPAND_DOUBLE_SIZE);
            loaHotspot[1]=Location3DImpl.create(dXStart + IConstants.LINE_EXPAND_DOUBLE_SIZE,dStart,dZEnd - IConstants.LINE_EXPAND_DOUBLE_SIZE);
            loaHotspot[2]=Location3DImpl.create(dXStart + IConstants.LINE_EXPAND_DOUBLE_SIZE,dEnd,dZEnd - IConstants.LINE_EXPAND_DOUBLE_SIZE);
            loaHotspot[3]=Location3DImpl.create(dXStart - IConstants.LINE_EXPAND_DOUBLE_SIZE,dEnd,dZEnd + IConstants.LINE_EXPAND_DOUBLE_SIZE);
            pre3d.setPoints3D(loaHotspot);
            pre3d.setDoubleSided(true);
            if (renderer.get3DEngine().processEvent(pre3d,panningOffset.getX(),panningOffset.getY()) != null) {
              final InteractionEvent iev=(InteractionEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),InteractionEvent.class);
              if (cachedTriggers == null) {
                cachedTriggers=new ArrayList();
                for (int t=0; t < elTriggers.size(); t++) {
                  tg=TriggerImpl.copyInstance((Trigger)elTriggers.get(t));
                  processTrigger(tg,StructureSource.createAxis(axModel));
                  cachedTriggers.add(tg);
                  iev.addTrigger(TriggerImpl.copyInstance(tg));
                }
              }
 else {
                for (int t=0; t < cachedTriggers.size(); t++) {
                  iev.addTrigger(TriggerImpl.copyInstance((Trigger)cachedTriggers.get(t)));
                }
              }
              iev.setHotSpot(pre3d);
              ipr.enableInteraction(iev);
            }
            pre3d=(Polygon3DRenderEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),Polygon3DRenderEvent.class);
            loaHotspot=new Location3D[4];
            loaHotspot[0]=Location3DImpl.create(dXEnd - IConstants.LINE_EXPAND_DOUBLE_SIZE,dStart,dZStart + IConstants.LINE_EXPAND_DOUBLE_SIZE);
            loaHotspot[1]=Location3DImpl.create(dXEnd + IConstants.LINE_EXPAND_DOUBLE_SIZE,dStart,dZStart - IConstants.LINE_EXPAND_DOUBLE_SIZE);
            loaHotspot[2]=Location3DImpl.create(dXEnd + IConstants.LINE_EXPAND_DOUBLE_SIZE,dEnd,dZStart - IConstants.LINE_EXPAND_DOUBLE_SIZE);
            loaHotspot[3]=Location3DImpl.create(dXEnd - IConstants.LINE_EXPAND_DOUBLE_SIZE,dEnd,dZStart + IConstants.LINE_EXPAND_DOUBLE_SIZE);
            pre3d.setPoints3D(loaHotspot);
            pre3d.setDoubleSided(true);
            if (renderer.get3DEngine().processEvent(pre3d,panningOffset.getX(),panningOffset.getY()) != null) {
              final InteractionEvent iev=(InteractionEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),InteractionEvent.class);
              if (cachedTriggers == null) {
                for (int t=0; t < elTriggers.size(); t++) {
                  tg=TriggerImpl.copyInstance((Trigger)elTriggers.get(t));
                  processTrigger(tg,StructureSource.createAxis(axModel));
                  iev.addTrigger(tg);
                }
              }
 else {
                for (int t=0; t < cachedTriggers.size(); t++) {
                  iev.addTrigger((Trigger)cachedTriggers.get(t));
                }
              }
              iev.setHotSpot(pre3d);
              ipr.enableInteraction(iev);
            }
          }
        }
      }
 else {
        double dStart=daEndPoints[0] + insCA.getBottom(), dEnd=daEndPoints[1] - insCA.getTop();
        if (sc.getDirection() == IConstants.FORWARD) {
          dStart=daEndPoints[1] + insCA.getBottom();
          dEnd=daEndPoints[0] - insCA.getTop();
        }
        if (iv != null && iv.getType() == IntersectionValue.VALUE && iDimension == IConstants.TWO_5_D) {
          final Location[] loa=new Location[4];
          loa[0]=LocationImpl.create(context.dX,dStart);
          loa[1]=LocationImpl.create(context.dX + dSeriesThickness,dStart - dSeriesThickness);
          loa[2]=LocationImpl.create(context.dX + dSeriesThickness,dEnd - dSeriesThickness);
          loa[3]=LocationImpl.create(context.dX,dEnd);
          final PolygonRenderEvent pre=(PolygonRenderEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),PolygonRenderEvent.class);
          pre.setPoints(loa);
          pre.setBackground(ColorDefinitionImpl.create(255,255,255,127));
          pre.setOutline(lia);
          ipr.fillPolygon(pre);
        }
        lre.setLineAttributes(lia);
        lre.getStart().set(context.dX,dStart);
        lre.getEnd().set(context.dX,dEnd);
        ipr.drawLine(lre);
        if (renderer.isInteractivityEnabled()) {
          Trigger tg;
          EList elTriggers=axModel.getTriggers();
          if (!elTriggers.isEmpty()) {
            final InteractionEvent iev=(InteractionEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),InteractionEvent.class);
            for (int t=0; t < elTriggers.size(); t++) {
              tg=TriggerImpl.copyInstance((Trigger)elTriggers.get(t));
              processTrigger(tg,StructureSource.createAxis(axModel));
              iev.addTrigger(tg);
            }
            Location[] loaHotspot=new Location[4];
            loaHotspot[0]=LocationImpl.create(context.dX - IConstants.LINE_EXPAND_SIZE,dStart);
            loaHotspot[1]=LocationImpl.create(context.dX + IConstants.LINE_EXPAND_SIZE,dStart);
            loaHotspot[2]=LocationImpl.create(context.dX + IConstants.LINE_EXPAND_SIZE,dEnd);
            loaHotspot[3]=LocationImpl.create(context.dX - IConstants.LINE_EXPAND_SIZE,dEnd);
            final PolygonRenderEvent pre=(PolygonRenderEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),PolygonRenderEvent.class);
            pre.setPoints(loaHotspot);
            iev.setHotSpot(pre);
            ipr.enableInteraction(iev);
          }
        }
      }
    }
    renderVerticalAxisByType(context,dXEnd,dZEnd,dZ,dStaggeredLabelOffset);
    la=LabelImpl.copyInstance(ax.getTitle());
    if (la.isVisible() && bRenderAxisTitle) {
      ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_AXIS_TITLE,axModel,la,getRunTimeContext().getScriptContext());
      getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_AXIS_TITLE,la);
      final String sRestoreValue=la.getCaption().getValue();
      la.getCaption().setValue(getRunTimeContext().externalizedMessage(sRestoreValue));
      BoundingBox bb=null;
      boolean bWithinAxis=false;
      final boolean bTitleHorizontal=Math.abs(la.getCaption().getFont().getRotation()) <= 30;
      final double dYAxisHeightPC=ChartUtil.computeHeightOfOrthogonalAxisTitle((ChartWithAxes)this.renderer.cm,xs);
      try {
        if (bTitleHorizontal) {
          bWithinAxis=true;
        }
 else {
          final BoundingBox bbWoWrap=Methods.computeBox(xs,iLabelLocation,la,0,0,dYAxisHeightPC);
          bWithinAxis=bbWoWrap.getHeight() < daEndPoints[0] - daEndPoints[1];
        }
        bb=Methods.computeBox(xs,ax.getTitlePosition(),la,0,0,bWithinAxis && !bTitleHorizontal ? daEndPoints[0] - daEndPoints[1] : dYAxisHeightPC);
      }
 catch (      IllegalArgumentException uiex) {
        throw new ChartException(ChartEnginePlugin.ID,ChartException.RENDERING,uiex);
      }
      if (ax.getTitle().isVisible() && la.isVisible()) {
        if (bRendering3D) {
          double yCenter=daEndPoints3D[0] + ((daEndPoints3D[1] - daEndPoints3D[0]) / 2);
          final double x=(iLabelLocation == IConstants.LEFT) ? context.dTick1 - 1 : context.dTick2 + 1;
          double sx=x;
          double sx2=dXEnd;
          if (bAxisLabelStaggered) {
            if (iLabelLocation == IConstants.LEFT) {
              sx-=dStaggeredLabelOffset;
              sx2+=dStaggeredLabelOffset;
            }
 else {
              sx+=dStaggeredLabelOffset;
              sx2-=dStaggeredLabelOffset;
            }
          }
          Angle3D a3D=(Angle3D)((ChartWithAxes)renderer.cm).getRotation().getAngles().get(0);
          double offset=2;
          t3dre=(Text3DRenderEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),Text3DRenderEvent.class);
          sx=sx - pwa.getHorizontalSpacingInPixels() - bb.getWidth()- bb.getHeight();
          t3dre.setLocation3D(Location3DImpl.create(sx - offset,yCenter,dZEnd + offset + pwa.getHorizontalSpacingInPixels()+ (bb.getWidth() + bb.getHeight()) * Math.sin(a3D.getYAngle() * Math.PI / 180)));
          t3dre.setLabel(la);
          t3dre.setTextPosition(Text3DRenderEvent.LEFT);
          t3dre.setAction(Text3DRenderEvent.RENDER_TEXT_AT_LOCATION);
          renderAxisTitleWith3DTextevent(bb);
          t3dre=(Text3DRenderEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),Text3DRenderEvent.class);
          sx2=sx2 + pwa.getHorizontalSpacingInPixels() + 100;
          t3dre.setLocation3D(Location3DImpl.create(sx2,yCenter,dZ - pwa.getHorizontalSpacingInPixels() - 100 * Math.sin(a3D.getYAngle() * Math.PI / 180)));
          t3dre.setLabel(la);
          t3dre.setTextPosition(Text3DRenderEvent.RIGHT);
          t3dre.setAction(Text3DRenderEvent.RENDER_TEXT_AT_LOCATION);
          renderAxisTitleWith3DTextevent(bb);
        }
 else {
          double dTop=computeTopOfOrthogonalAxisTitle();
          final Bounds bo=BoundsImpl.create(ax.getTitleCoordinate(),bWithinAxis ? daEndPoints[1] : dTop,bb.getWidth(),bWithinAxis ? daEndPoints[0] - daEndPoints[1] : dYAxisHeightPC);
          tre.setBlockBounds(bo);
          tre.setLabel(la);
          if (ax.getModelAxis().getAssociatedAxes().size() != 0) {
            tre.setBlockAlignment(ChartUtil.transposeAlignment(la.getCaption().getFont().getAlignment()));
          }
 else {
            tre.setBlockAlignment(la.getCaption().getFont().getAlignment());
          }
          tre.setAction(TextRenderEvent.RENDER_TEXT_IN_BLOCK);
          if (ax.getTitle().isVisible()) {
            ipr.drawText(tre);
          }
        }
      }
      la.getCaption().setValue(sRestoreValue);
      ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_AXIS_TITLE,axModel,la,getRunTimeContext().getScriptContext());
      getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_AXIS_TITLE,la);
    }
    la=LabelImpl.copyInstance(ax.getLabel());
    if (iv != null && iv.getType() == IntersectionValue.MAX && iDimension == IConstants.TWO_5_D) {
      trae.setTranslation(-dSeriesThickness,dSeriesThickness);
      ipr.applyTransformation(trae);
    }
  }
 else   if (iOrientation == IConstants.HORIZONTAL) {
    final ComputationContext context=new ComputationContext(false);
    context.x3d=0;
    context.z3d=0;
    context.dY=dLocation;
    double dX=0;
    double dZ=0;
    if (bRendering3D) {
      Location3D l3d=ax.getAxisCoordinate3D();
      dX=l3d.getX();
      context.dY=l3d.getY();
      dZ=l3d.getZ();
    }
    context.dTick1=((iMajorTickStyle & IConstants.TICK_ABOVE) == IConstants.TICK_ABOVE) ? (bRendering3D ? context.dY + pwa.getTickSize() : context.dY - pwa.getTickSize()) : context.dY;
    context.dTick2=((iMajorTickStyle & IConstants.TICK_BELOW) == IConstants.TICK_BELOW) ? (bRendering3D ? context.dY - pwa.getTickSize() : context.dY + pwa.getTickSize()) : context.dY;
    if (iv != null && iDimension == IConstants.TWO_5_D && ((bTransposed && renderer.isRightToLeft() && iv.getType() == IntersectionValue.MIN) || (!renderer.isRightToLeft() && iv.getType() == IntersectionValue.MAX))) {
      trae.setTransform(TransformationEvent.TRANSLATE);
      trae.setTranslation(dSeriesThickness,-dSeriesThickness);
      ipr.applyTransformation(trae);
    }
    if ((iWhatToDraw & IConstants.AXIS) == IConstants.AXIS && lia.isVisible()) {
      if (bRenderBase3DAxis) {
        final double dStart=daEndPoints3D[0];
        final double dEnd=daEndPoints3D[1];
        l3dre.setLineAttributes(lia);
        l3dre.setStart3D(dStart,context.dY,dZ);
        l3dre.setEnd3D(dEnd,context.dY,dZ);
        dc.addLine(l3dre);
        if (renderer.isInteractivityEnabled()) {
          Trigger tg;
          EList elTriggers=axModel.getTriggers();
          if (!elTriggers.isEmpty()) {
            final Polygon3DRenderEvent pre3d=(Polygon3DRenderEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),Polygon3DRenderEvent.class);
            Location3D[] loaHotspot=new Location3D[4];
            loaHotspot[0]=Location3DImpl.create(dStart,context.dY - IConstants.LINE_EXPAND_DOUBLE_SIZE,dZ);
            loaHotspot[1]=Location3DImpl.create(dStart,context.dY + IConstants.LINE_EXPAND_DOUBLE_SIZE,dZ);
            loaHotspot[2]=Location3DImpl.create(dEnd,context.dY + IConstants.LINE_EXPAND_DOUBLE_SIZE,dZ);
            loaHotspot[3]=Location3DImpl.create(dEnd,context.dY - IConstants.LINE_EXPAND_DOUBLE_SIZE,dZ);
            pre3d.setPoints3D(loaHotspot);
            pre3d.setDoubleSided(true);
            if (renderer.get3DEngine().processEvent(pre3d,panningOffset.getX(),panningOffset.getY()) != null) {
              final InteractionEvent iev=(InteractionEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),InteractionEvent.class);
              for (int t=0; t < elTriggers.size(); t++) {
                tg=TriggerImpl.copyInstance((Trigger)elTriggers.get(t));
                processTrigger(tg,StructureSource.createAxis(axModel));
                iev.addTrigger(tg);
              }
              iev.setHotSpot(pre3d);
              ipr.enableInteraction(iev);
            }
          }
        }
      }
 else       if (bRenderAncillary3DAxis) {
        final double dStart=daEndPoints3D[0];
        final double dEnd=daEndPoints3D[1];
        l3dre.setLineAttributes(lia);
        l3dre.setStart3D(dX,context.dY,dStart);
        l3dre.setEnd3D(dX,context.dY,dEnd);
        dc.addLine(l3dre);
        if (renderer.isInteractivityEnabled()) {
          Trigger tg;
          EList elTriggers=axModel.getTriggers();
          if (!elTriggers.isEmpty()) {
            final Polygon3DRenderEvent pre3d=(Polygon3DRenderEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),Polygon3DRenderEvent.class);
            Location3D[] loaHotspot=new Location3D[4];
            loaHotspot[0]=Location3DImpl.create(dX,context.dY - IConstants.LINE_EXPAND_DOUBLE_SIZE,dStart);
            loaHotspot[1]=Location3DImpl.create(dX,context.dY + IConstants.LINE_EXPAND_DOUBLE_SIZE,dStart);
            loaHotspot[2]=Location3DImpl.create(dX,context.dY + IConstants.LINE_EXPAND_DOUBLE_SIZE,dEnd);
            loaHotspot[3]=Location3DImpl.create(dX,context.dY - IConstants.LINE_EXPAND_DOUBLE_SIZE,dEnd);
            pre3d.setPoints3D(loaHotspot);
            pre3d.setDoubleSided(true);
            if (renderer.get3DEngine().processEvent(pre3d,panningOffset.getX(),panningOffset.getY()) != null) {
              final InteractionEvent iev=(InteractionEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),InteractionEvent.class);
              for (int t=0; t < elTriggers.size(); t++) {
                tg=TriggerImpl.copyInstance((Trigger)elTriggers.get(t));
                processTrigger(tg,StructureSource.createAxis(axModel));
                iev.addTrigger(tg);
              }
              iev.setHotSpot(pre3d);
              ipr.enableInteraction(iev);
            }
          }
        }
      }
 else {
        double dStart=daEndPoints[0] - insCA.getLeft(), dEnd=daEndPoints[1] + insCA.getRight();
        if (sc.getDirection() == IConstants.BACKWARD) {
          dStart=daEndPoints[1] - insCA.getLeft();
          dEnd=daEndPoints[0] + insCA.getRight();
        }
        if (iv != null && iv.getType() == IntersectionValue.VALUE && iDimension == IConstants.TWO_5_D) {
          final Location[] loa=new Location[4];
          loa[0]=LocationImpl.create(dStart,context.dY);
          loa[1]=LocationImpl.create(dStart + dSeriesThickness,context.dY - dSeriesThickness);
          loa[2]=LocationImpl.create(dEnd + dSeriesThickness,context.dY - dSeriesThickness);
          loa[3]=LocationImpl.create(dEnd,context.dY);
          final PolygonRenderEvent pre=(PolygonRenderEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),PolygonRenderEvent.class);
          pre.setPoints(loa);
          pre.setBackground(ColorDefinitionImpl.create(255,255,255,127));
          pre.setOutline(lia);
          ipr.fillPolygon(pre);
        }
        lre.setLineAttributes(lia);
        lre.getStart().set(dStart,context.dY);
        lre.getEnd().set(dEnd,context.dY);
        ipr.drawLine(lre);
        if (renderer.isInteractivityEnabled()) {
          Trigger tg;
          EList elTriggers=axModel.getTriggers();
          if (!elTriggers.isEmpty()) {
            final InteractionEvent iev=(InteractionEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),InteractionEvent.class);
            for (int t=0; t < elTriggers.size(); t++) {
              tg=TriggerImpl.copyInstance((Trigger)elTriggers.get(t));
              processTrigger(tg,StructureSource.createAxis(axModel));
              iev.addTrigger(tg);
            }
            Location[] loaHotspot=new Location[4];
            loaHotspot[0]=LocationImpl.create(dStart,context.dY - IConstants.LINE_EXPAND_SIZE);
            loaHotspot[1]=LocationImpl.create(dEnd,context.dY - IConstants.LINE_EXPAND_SIZE);
            loaHotspot[2]=LocationImpl.create(dEnd,context.dY + IConstants.LINE_EXPAND_SIZE);
            loaHotspot[3]=LocationImpl.create(dStart,context.dY + IConstants.LINE_EXPAND_SIZE);
            final PolygonRenderEvent pre=(PolygonRenderEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),PolygonRenderEvent.class);
            pre.setPoints(loaHotspot);
            iev.setHotSpot(pre);
            ipr.enableInteraction(iev);
          }
        }
      }
    }
    renderHorizontalAxisByType(context,dXEnd,dZEnd,dZ,dStaggeredLabelOffset);
    la=LabelImpl.copyInstance(ax.getTitle());
    if (la.isVisible() && bRenderAxisTitle) {
      ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_AXIS_TITLE,axModel,la,getRunTimeContext().getScriptContext());
      getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_AXIS_TITLE,la);
      final String sRestoreValue=la.getCaption().getValue();
      la.getCaption().setValue(getRunTimeContext().externalizedMessage(sRestoreValue));
      la.getCaption().getFont().setAlignment(renderer.switchTextAlignment(la.getCaption().getFont().getAlignment()));
      BoundingBox bb=null;
      try {
        bb=Methods.computeBox(xs,ax.getTitlePosition(),la,0,0,Math.abs(daEndPoints[1] - daEndPoints[0]));
      }
 catch (      IllegalArgumentException uiex) {
        throw new ChartException(ChartEnginePlugin.ID,ChartException.RENDERING,uiex);
      }
      if (ax.getTitle().isVisible() && la.isVisible()) {
        if (bRendering3D) {
          Angle3D a3D=(Angle3D)((ChartWithAxes)renderer.cm).getRotation().getAngles().get(0);
          if (axisType == IConstants.BASE_AXIS) {
            t3dre=(Text3DRenderEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),Text3DRenderEvent.class);
            IAxisTypeComputation computation=createAxisTypeComputation(context);
            computation.initialize();
            final int length=computation instanceof TextAxisTypeComputation ? da.size() - 1 : da.size();
            int xStart=(int)da3D.getCoordinate(0);
            int xEnd=(int)da3D.getCoordinate(length - 1);
            int x=xStart + (xEnd - xStart) / 2;
            Location3D location=Location3DImpl.create(x,context.dY - bb.getHeight() * 3,dZEnd + pwa.getVerticalSpacingInPixels());
            t3dre.setLocation3D(location);
            t3dre.setLabel(la);
            double angle=(a3D.getZAngle() + a3D.getXAngle()) % 360;
            if (angle > 0 && angle <= 180) {
              t3dre.setTextPosition(Text3DRenderEvent.RIGHT);
            }
 else {
              t3dre.setTextPosition(Text3DRenderEvent.LEFT);
            }
            t3dre.setAction(Text3DRenderEvent.RENDER_TEXT_AT_LOCATION);
          }
 else {
            Location3D location=Location3DImpl.create(dXEnd,context.dY - bb.getHeight(),dZ + (dZEnd - dZ) / 2);
            t3dre.setLocation3D(location);
            t3dre.setLabel(la);
            double angle=a3D.getZAngle() % 360;
            if (angle >= 0 && angle < 180) {
              t3dre.setTextPosition(Text3DRenderEvent.RIGHT);
            }
 else {
              t3dre.setTextPosition(Text3DRenderEvent.LEFT);
            }
            t3dre.setAction(Text3DRenderEvent.RENDER_TEXT_AT_LOCATION);
          }
          renderAxisTitleWith3DTextevent(bb);
        }
 else {
          final Bounds bo=BoundsImpl.create(daEndPoints[0],ax.getTitleCoordinate(),daEndPoints[1] - daEndPoints[0],bb.getHeight());
          tre.setBlockBounds(bo);
          tre.setLabel(la);
          if (ax.getModelAxis().getAssociatedAxes().size() != 0) {
            tre.setBlockAlignment(la.getCaption().getFont().getAlignment());
          }
 else {
            tre.setBlockAlignment(ChartUtil.transposeAlignment(la.getCaption().getFont().getAlignment()));
          }
          tre.setAction(TextRenderEvent.RENDER_TEXT_IN_BLOCK);
          ipr.drawText(tre);
        }
      }
      ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_AXIS_TITLE,axModel,la,getRunTimeContext().getScriptContext());
      getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_AXIS_TITLE,la);
    }
    la=LabelImpl.copyInstance(ax.getLabel());
    if (iv != null && iDimension == IConstants.TWO_5_D && ((bTransposed && renderer.isRightToLeft() && iv.getType() == IntersectionValue.MIN) || (!renderer.isRightToLeft() && iv.getType() == IntersectionValue.MAX))) {
      trae.setTranslation(-dSeriesThickness,dSeriesThickness);
      ipr.applyTransformation(trae);
    }
  }
}