Program: 68540
Project: 68540
Buggy source:
@SuppressWarnings("String_Node_Str") public void renderSeries(IPrimitiveRenderer ipr,Plot p,ISeriesRenderingHints isrh) throws ChartException {
  try {
    validateDataSetCount(isrh);
  }
 catch (  ChartException vex) {
    throw new ChartException(ChartEngineExtensionPlugin.ID,ChartException.RENDERING,vex);
  }
  boolean bRendering3D=isDimension3D();
  SeriesRenderingHints srh=null;
  SeriesRenderingHints3D srh3d=null;
  if (bRendering3D) {
    srh3d=(SeriesRenderingHints3D)isrh;
  }
 else {
    srh=(SeriesRenderingHints)isrh;
  }
  ChartWithAxes cwa=(ChartWithAxes)getModel();
  logger.log(ILogger.INFORMATION,Messages.getString("String_Node_Str",new Object[]{getClass().getName(),Integer.valueOf(iSeriesIndex + 1),Integer.valueOf(iSeriesCount)},getRunTimeContext().getULocale()));
  final Bounds boClientArea=isrh.getClientAreaBounds(true);
  final double dSeriesThickness=bRendering3D ? 0 : srh.getSeriesThickness();
  if (cwa.getDimension() == ChartDimension.TWO_DIMENSIONAL_WITH_DEPTH_LITERAL) {
    boClientArea.delta(-dSeriesThickness,dSeriesThickness,0,0);
  }
  LineSeries ls=(LineSeries)getSeries();
  if (!ls.isVisible()) {
    restoreClipping(ipr);
    return;
  }
  ChartDimension cd=cwa.getDimension();
  final AbstractScriptHandler<?> sh=getRunTimeContext().getScriptHandler();
  DataPointHints[] dpha=isrh.getDataPoints();
  validateNullDatapoint(dpha);
  double fX=0, fY=0, fZ=0, fWidth=0, fWidthZ=0, fHeight=0;
  Location lo=null;
  Location3D lo3d=null;
  boolean isAreaSeries=(getSeries() instanceof AreaSeries && !(getSeries() instanceof DifferenceSeries));
  boolean bShowAsTape=(cd.getValue() == ChartDimension.THREE_DIMENSIONAL) || (isAreaSeries && cd.getValue() == ChartDimension.TWO_DIMENSIONAL_WITH_DEPTH);
  if (bShowAsTape) {
    bShowAsTape=validateShowAsTape();
  }
  AxisSubUnit au;
  Axis ax=getAxis();
  double dValue, dEnd;
  StackedSeriesLookup ssl=null;
  if (!bRendering3D) {
    ssl=srh.getStackedSeriesLookup();
  }
  LineAttributes lia=ls.getLineAttributes();
  double[] faX=new double[dpha.length];
  double[] faY=new double[dpha.length];
  double[] faZ=new double[dpha.length];
  SeriesDefinition sd=getSeriesDefinition();
  final EList<Fill> elPalette=sd.getSeriesPalette().getEntries();
  if (elPalette.isEmpty()) {
    throw new ChartException(ChartEngineExtensionPlugin.ID,ChartException.RENDERING,"String_Node_Str",new Object[]{ls},Messages.getResourceBundle(getRunTimeContext().getULocale()));
  }
  final boolean bPaletteByCategory=isPaletteByCategory();
  if (bPaletteByCategory && ls.eContainer() instanceof SeriesDefinition) {
    sd=(SeriesDefinition)ls.eContainer();
  }
  int iThisSeriesIndex=sd.getRunTimeSeries().indexOf(ls);
  if (iThisSeriesIndex < 0) {
    throw new ChartException(ChartEngineExtensionPlugin.ID,ChartException.RENDERING,"String_Node_Str",new Object[]{ls,sd},Messages.getResourceBundle(getRunTimeContext().getULocale()));
  }
  Marker m=null;
  if (ls.getMarkers().size() > 0) {
    m=ls.getMarkers().get(iThisSeriesIndex % ls.getMarkers().size());
  }
  Fill fPaletteEntry=null;
  if (!bPaletteByCategory) {
    fPaletteEntry=FillUtil.getPaletteFill(elPalette,iThisSeriesIndex);
  }
 else   if (iSeriesIndex > 0) {
    fPaletteEntry=FillUtil.getPaletteFill(elPalette,iSeriesIndex - 1);
  }
  updateTranslucency(fPaletteEntry,ls);
  double dTapeWidth=-1;
  double dUnitSpacingZ=0;
  for (int i=0; i < dpha.length; i++) {
    if (bRendering3D) {
      lo3d=dpha[i].getLocation3D();
      if (ChartUtil.mathEqual(dTapeWidth,-1)) {
        final double dUnitSpacing=(!cwa.isSetUnitSpacing()) ? 50 : cwa.getUnitSpacing();
        dTapeWidth=dpha[i].getSize2D().getHeight() * (100 - dUnitSpacing) / 100;
        dUnitSpacingZ=dpha[i].getSize2D().getHeight() * dUnitSpacing / 200;
      }
    }
 else {
      lo=dpha[i].getLocation();
    }
    if (cwa.isTransposed()) {
      if (srh.isCategoryScale()) {
        fHeight=dpha[i].getSize();
      }
      fY=(lo.getY() + fHeight / 2.0);
      faY[i]=fY;
      if (ls.isStacked() || ax.isPercent()) {
        au=ssl.getUnit(ls,i);
        dValue=isNaN(dpha[i].getOrthogonalValue()) ? 0 : ((Double)dpha[i].getOrthogonalValue()).doubleValue();
        dEnd=computeStackPosition(au,dValue,ax);
        try {
          faX[i]=Math.floor(srh.getLocationOnOrthogonal(new Double(dEnd)));
          dpha[i].setStackOrthogonalValue(new Double(dEnd));
          if (faX[i] < srh.getPlotBaseLocation()) {
            faX[i]=srh.getPlotBaseLocation();
          }
          au.setLastPosition(dValue,faX[i],0);
        }
 catch (        Exception ex) {
          throw new ChartException(ChartEngineExtensionPlugin.ID,ChartException.RENDERING,ex);
        }
      }
 else {
        faX[i]=lo.getX();
      }
    }
 else {
      if (bRendering3D) {
        fWidth=dpha[i].getSize2D().getWidth();
        fWidthZ=dpha[i].getSize2D().getHeight();
        fX=lo3d.getX() + fWidth / 2;
        fZ=lo3d.getZ() + fWidthZ - dUnitSpacingZ;
        faX[i]=fX;
        faZ[i]=fZ;
      }
 else {
        if (srh.isCategoryScale()) {
          fWidth=dpha[i].getSize();
        }
        fX=(lo.getX() + fWidth / 2.0);
        faX[i]=fX;
      }
      if (ls.isStacked() || ax.isPercent()) {
        if (bRendering3D) {
          throw new ChartException(ChartEngineExtensionPlugin.ID,ChartException.COMPUTATION,"String_Node_Str",Messages.getResourceBundle(getRunTimeContext().getULocale()));
        }
        au=ssl.getUnit(ls,i);
        dValue=isNaN(dpha[i].getOrthogonalValue()) ? 0 : ((Double)dpha[i].getOrthogonalValue()).doubleValue();
        dEnd=computeStackPosition(au,dValue,ax);
        try {
          faY[i]=Math.floor(srh.getLocationOnOrthogonal(new Double(dEnd)));
          dpha[i].setStackOrthogonalValue(new Double(dEnd));
          au.setLastPosition(dValue,faY[i],0);
        }
 catch (        Exception ex) {
          throw new ChartException(ChartEngineExtensionPlugin.ID,ChartException.RENDERING,ex);
        }
      }
 else {
        if (bRendering3D) {
          faY[i]=lo3d.getY();
        }
 else {
          faY[i]=lo.getY();
        }
      }
      if (bRendering3D) {
        double plotBaseLocation=srh3d.getPlotBaseLocation();
        if (faY[i] < plotBaseLocation) {
          faY[i]=plotBaseLocation;
        }
        if (faY[i] > plotBaseLocation + srh3d.getPlotHeight()) {
          faY[i]=plotBaseLocation + srh3d.getPlotHeight();
        }
      }
    }
  }
  if (!bRendering3D) {
    handleOutsideDataPoints(ipr,srh,faX,faY,bShowAsTape);
  }
  if (ls.isCurve()) {
    renderAsCurve(ipr,ls.getLineAttributes(),bRendering3D ? (ISeriesRenderingHints)srh3d : srh,bRendering3D ? goFactory.createLocation3Ds(faX,faY,faZ) : goFactory.createLocations(faX,faY),bShowAsTape,dTapeWidth,fPaletteEntry,ls.isPaletteLineColor());
    renderShadowAsCurve(ipr,lia,bRendering3D ? (ISeriesRenderingHints)srh3d : srh,bRendering3D ? goFactory.createLocation3Ds(faX,faY,faZ) : goFactory.createLocations(faX,faY),bShowAsTape,dTapeWidth);
    if (m != null) {
      for (int i=0; i < dpha.length; i++) {
        if (dpha[i].isOutside()) {
          continue;
        }
        if (bPaletteByCategory) {
          fPaletteEntry=FillUtil.getPaletteFill(elPalette,i);
        }
 else {
          fPaletteEntry=FillUtil.getPaletteFill(elPalette,iThisSeriesIndex);
        }
        updateTranslucency(fPaletteEntry,ls);
        ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_ELEMENT,dpha[i],fPaletteEntry);
        ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_DATA_POINT,dpha[i],fPaletteEntry,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_ELEMENT,dpha[i]);
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_DATA_POINT,dpha[i]);
        renderMarker(ls,ipr,m,bRendering3D ? goFactory.createLocation3D(faX[i],faY[i],faZ[i]) : goFactory.createLocation(faX[i],faY[i]),ls.getLineAttributes(),fPaletteEntry,dpha[i],null,true,true);
        ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_ELEMENT,dpha[i],fPaletteEntry);
        ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_DATA_POINT,dpha[i],fPaletteEntry,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_ELEMENT,dpha[i]);
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_DATA_POINT,dpha[i]);
      }
    }
  }
 else {
    renderShadow(ipr,p,lia,bRendering3D ? goFactory.createLocation3Ds(faX,faY,faZ) : goFactory.createLocations(faX,faY),bShowAsTape,dpha);
    renderDataPoints(ipr,p,bRendering3D ? (ISeriesRenderingHints)srh3d : srh,dpha,lia,bRendering3D ? goFactory.createLocation3Ds(faX,faY,faZ) : goFactory.createLocations(faX,faY),bShowAsTape,dTapeWidth,fPaletteEntry,ls.isPaletteLineColor());
    if (m != null) {
      for (int i=0; i < dpha.length; i++) {
        if (bPaletteByCategory) {
          fPaletteEntry=FillUtil.getPaletteFill(elPalette,i);
        }
 else {
          fPaletteEntry=FillUtil.getPaletteFill(elPalette,iThisSeriesIndex);
        }
        updateTranslucency(fPaletteEntry,ls);
        ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_ELEMENT,dpha[i],fPaletteEntry);
        ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_DATA_POINT,dpha[i],fPaletteEntry,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_ELEMENT,dpha[i]);
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_DATA_POINT,dpha[i]);
        renderMarker(ls,ipr,m,bRendering3D ? goFactory.createLocation3D(faX[i],faY[i],faZ[i]) : goFactory.createLocation(faX[i],faY[i]),ls.getLineAttributes(),fPaletteEntry,dpha[i],null,true,true);
        ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_ELEMENT,dpha[i],fPaletteEntry);
        ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_DATA_POINT,dpha[i],fPaletteEntry,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_ELEMENT,dpha[i]);
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_DATA_POINT,dpha[i]);
      }
    }
  }
  Label laDataPoint=null;
  Position pDataPoint=null;
  Location loDataPoint=null;
  Location3D loDataPoint3d=null;
  try {
    if (bRendering3D) {
      laDataPoint=srh3d.getLabelAttributes(ls);
      if (laDataPoint.isVisible()) {
        pDataPoint=srh3d.getLabelPosition(ls);
        loDataPoint3d=goFactory.createLocation3D(0,0,0);
      }
    }
 else {
      laDataPoint=srh.getLabelAttributes(ls);
      if (laDataPoint.isVisible()) {
        pDataPoint=srh.getLabelPosition(ls);
        loDataPoint=goFactory.createLocation(0,0);
      }
    }
  }
 catch (  Exception ex) {
    throw new ChartException(ChartEngineExtensionPlugin.ID,ChartException.RENDERING,ex);
  }
  if (laDataPoint.isVisible()) {
    final double dSize=m == null ? 0 : m.getSize();
    for (int i=0; i < dpha.length; i++) {
      if (isNaN(dpha[i].getOrthogonalValue()) || dpha[i].isOutside()) {
        continue;
      }
      laDataPoint=bRendering3D ? srh3d.getLabelAttributes(ls) : srh.getLabelAttributes(ls);
      laDataPoint.getCaption().setValue(dpha[i].getDisplayValue());
      ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_DATA_POINT_LABEL,dpha[i],laDataPoint,getRunTimeContext().getScriptContext());
      getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_DATA_POINT_LABEL,laDataPoint);
      if (laDataPoint.isVisible()) {
        if (bRendering3D) {
switch (pDataPoint.getValue()) {
case Position.ABOVE:
            loDataPoint3d.set(faX[i],faY[i] + dSize + p.getVerticalSpacing(),faZ[i] + 1);
          break;
case Position.BELOW:
        loDataPoint3d.set(faX[i],faY[i] - dSize - p.getVerticalSpacing(),faZ[i] + 1);
      break;
case Position.LEFT:
    loDataPoint3d.set(faX[i] - dSize - p.getHorizontalSpacing(),faY[i],faZ[i] + 1);
  break;
case Position.RIGHT:
loDataPoint3d.set(faX[i] + dSize + p.getHorizontalSpacing(),faY[i],faZ[i] + 1);
break;
default :
throw new ChartException(ChartEngineExtensionPlugin.ID,ChartException.RENDERING,"String_Node_Str",new Object[]{pDataPoint.getName()},Messages.getResourceBundle(getRunTimeContext().getULocale()));
}
final Text3DRenderEvent tre3d=((EventObjectCache)ipr).getEventObject(WrappedStructureSource.createSeriesDataPoint(ls,dpha[i]),Text3DRenderEvent.class);
tre3d.setAction(TextRenderEvent.RENDER_TEXT_AT_LOCATION);
tre3d.setLabel(laDataPoint);
tre3d.setTextPosition(Methods.getLabelPosition(pDataPoint));
tre3d.setLocation3D(loDataPoint3d);
getDeferredCache().addLabel(tre3d);
}
 else {
switch (pDataPoint.getValue()) {
case Position.ABOVE:
loDataPoint.set(faX[i],faY[i] - dSize - p.getVerticalSpacing());
break;
case Position.BELOW:
loDataPoint.set(faX[i],faY[i] + dSize + p.getVerticalSpacing());
break;
case Position.LEFT:
loDataPoint.set(faX[i] - dSize - p.getHorizontalSpacing(),faY[i]);
break;
case Position.RIGHT:
loDataPoint.set(faX[i] + dSize + p.getHorizontalSpacing(),faY[i]);
break;
default :
throw new ChartException(ChartEngineExtensionPlugin.ID,ChartException.RENDERING,"String_Node_Str",new Object[]{pDataPoint.getName()},Messages.getResourceBundle(getRunTimeContext().getULocale()));
}
renderLabel(WrappedStructureSource.createSeriesDataPoint(ls,dpha[i]),TextRenderEvent.RENDER_TEXT_AT_LOCATION,laDataPoint,pDataPoint,loDataPoint,null);
}
}
ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_DATA_POINT_LABEL,dpha[i],laDataPoint,getRunTimeContext().getScriptContext());
getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_DATA_POINT_LABEL,laDataPoint);
}
}
if (!bRendering3D && getSeries().getCurveFitting() != null) {
Location[] larray=new Location[faX.length];
for (int i=0; i < larray.length; i++) {
larray[i]=goFactory.createLocation(faX[i],faY[i]);
}
larray=filterNull(larray);
renderFittingCurve(ipr,larray,getSeries().getCurveFitting(),false,true);
}
if (!bRendering3D) {
restoreClipping(ipr);
}
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public void renderSeries(IPrimitiveRenderer ipr,Plot p,ISeriesRenderingHints isrh) throws ChartException {
  try {
    validateDataSetCount(isrh);
  }
 catch (  ChartException vex) {
    throw new ChartException(ChartEngineExtensionPlugin.ID,ChartException.RENDERING,vex);
  }
  boolean bRendering3D=isDimension3D();
  SeriesRenderingHints srh=null;
  SeriesRenderingHints3D srh3d=null;
  if (bRendering3D) {
    srh3d=(SeriesRenderingHints3D)isrh;
  }
 else {
    srh=(SeriesRenderingHints)isrh;
  }
  ChartWithAxes cwa=(ChartWithAxes)getModel();
  logger.log(ILogger.INFORMATION,Messages.getString("String_Node_Str",new Object[]{getClass().getName(),Integer.valueOf(iSeriesIndex + 1),Integer.valueOf(iSeriesCount)},getRunTimeContext().getULocale()));
  final Bounds boClientArea=isrh.getClientAreaBounds(true);
  final double dSeriesThickness=bRendering3D ? 0 : srh.getSeriesThickness();
  if (cwa.getDimension() == ChartDimension.TWO_DIMENSIONAL_WITH_DEPTH_LITERAL) {
    boClientArea.delta(-dSeriesThickness,dSeriesThickness,0,0);
  }
  LineSeries ls=(LineSeries)getSeries();
  if (!ls.isVisible()) {
    restoreClipping(ipr);
    return;
  }
  ChartDimension cd=cwa.getDimension();
  final AbstractScriptHandler<?> sh=getRunTimeContext().getScriptHandler();
  DataPointHints[] dpha=isrh.getDataPoints();
  validateNullDatapoint(dpha);
  double fX=0, fY=0, fZ=0, fWidth=0, fWidthZ=0, fHeight=0;
  Location lo=null;
  Location3D lo3d=null;
  boolean isAreaSeries=(getSeries() instanceof AreaSeries && !(getSeries() instanceof DifferenceSeries));
  boolean bShowAsTape=(cd.getValue() == ChartDimension.THREE_DIMENSIONAL) || (isAreaSeries && cd.getValue() == ChartDimension.TWO_DIMENSIONAL_WITH_DEPTH);
  if (bShowAsTape) {
    bShowAsTape=validateShowAsTape();
  }
  AxisSubUnit au;
  Axis ax=getAxis();
  double dValue, dEnd;
  StackedSeriesLookup ssl=null;
  if (!bRendering3D) {
    ssl=srh.getStackedSeriesLookup();
  }
  LineAttributes lia=ls.getLineAttributes();
  double[] faX=new double[dpha.length];
  double[] faY=new double[dpha.length];
  double[] faZ=new double[dpha.length];
  SeriesDefinition sd=getSeriesDefinition();
  final EList<Fill> elPalette=sd.getSeriesPalette().getEntries();
  if (elPalette.isEmpty()) {
    throw new ChartException(ChartEngineExtensionPlugin.ID,ChartException.RENDERING,"String_Node_Str",new Object[]{ls},Messages.getResourceBundle(getRunTimeContext().getULocale()));
  }
  final boolean bPaletteByCategory=isPaletteByCategory();
  if (bPaletteByCategory && ls.eContainer() instanceof SeriesDefinition) {
    sd=(SeriesDefinition)ls.eContainer();
  }
  int iThisSeriesIndex=sd.getRunTimeSeries().indexOf(ls);
  if (iThisSeriesIndex < 0) {
    throw new ChartException(ChartEngineExtensionPlugin.ID,ChartException.RENDERING,"String_Node_Str",new Object[]{ls,sd},Messages.getResourceBundle(getRunTimeContext().getULocale()));
  }
  Marker m=null;
  if (ls.getMarkers().size() > 0) {
    m=ls.getMarkers().get(iThisSeriesIndex % ls.getMarkers().size());
  }
  Fill fPaletteEntry=null;
  if (!bPaletteByCategory) {
    fPaletteEntry=FillUtil.getPaletteFill(elPalette,iThisSeriesIndex);
  }
 else   if (iSeriesIndex > 0) {
    fPaletteEntry=FillUtil.getPaletteFill(elPalette,iSeriesIndex - 1);
  }
  updateTranslucency(fPaletteEntry,ls);
  double dTapeWidth=-1;
  double dUnitSpacingZ=0;
  for (int i=0; i < dpha.length; i++) {
    if (bRendering3D) {
      lo3d=dpha[i].getLocation3D();
      if (ChartUtil.mathEqual(dTapeWidth,-1)) {
        final double dUnitSpacing=(!cwa.isSetUnitSpacing()) ? 50 : cwa.getUnitSpacing();
        dTapeWidth=dpha[i].getSize2D().getHeight() * (100 - dUnitSpacing) / 100;
        dUnitSpacingZ=dpha[i].getSize2D().getHeight() * dUnitSpacing / 200;
      }
    }
 else {
      lo=dpha[i].getLocation();
    }
    if (cwa.isTransposed()) {
      if (srh.isCategoryScale()) {
        fHeight=dpha[i].getSize();
      }
      fY=(lo.getY() + fHeight / 2.0);
      faY[i]=fY;
      if (ls.isStacked() || ax.isPercent()) {
        au=ssl.getUnit(ls,i);
        dValue=isNaN(dpha[i].getOrthogonalValue()) ? 0 : ((Double)dpha[i].getOrthogonalValue()).doubleValue();
        dEnd=computeStackPosition(au,dValue,ax);
        try {
          faX[i]=Math.floor(srh.getLocationOnOrthogonal(new Double(dEnd)));
          dpha[i].setStackOrthogonalValue(new Double(dEnd));
          if (faX[i] < srh.getPlotBaseLocation()) {
            faX[i]=srh.getPlotBaseLocation();
          }
          au.setLastPosition(dValue,faX[i],0);
        }
 catch (        Exception ex) {
          throw new ChartException(ChartEngineExtensionPlugin.ID,ChartException.RENDERING,ex);
        }
      }
 else {
        faX[i]=lo.getX();
      }
    }
 else {
      if (bRendering3D) {
        fWidth=dpha[i].getSize2D().getWidth();
        fWidthZ=dpha[i].getSize2D().getHeight();
        fX=lo3d.getX() + fWidth / 2;
        fZ=lo3d.getZ() + fWidthZ - dUnitSpacingZ;
        faX[i]=fX;
        faZ[i]=fZ;
      }
 else {
        if (srh.isCategoryScale()) {
          fWidth=dpha[i].getSize();
        }
        fX=(lo.getX() + fWidth / 2.0);
        faX[i]=fX;
      }
      if (ls.isStacked() || ax.isPercent()) {
        if (bRendering3D) {
          throw new ChartException(ChartEngineExtensionPlugin.ID,ChartException.COMPUTATION,"String_Node_Str",Messages.getResourceBundle(getRunTimeContext().getULocale()));
        }
        au=ssl.getUnit(ls,i);
        dValue=isNaN(dpha[i].getOrthogonalValue()) ? 0 : ((Double)dpha[i].getOrthogonalValue()).doubleValue();
        dEnd=computeStackPosition(au,dValue,ax);
        try {
          faY[i]=Math.floor(srh.getLocationOnOrthogonal(new Double(dEnd)));
          dpha[i].setStackOrthogonalValue(new Double(dEnd));
          au.setLastPosition(dValue,faY[i],0);
        }
 catch (        Exception ex) {
          throw new ChartException(ChartEngineExtensionPlugin.ID,ChartException.RENDERING,ex);
        }
      }
 else {
        if (bRendering3D) {
          faY[i]=lo3d.getY();
        }
 else {
          faY[i]=lo.getY();
        }
      }
      if (bRendering3D) {
        double plotBaseLocation=srh3d.getPlotBaseLocation();
        if (faY[i] < plotBaseLocation) {
          faY[i]=plotBaseLocation;
        }
        if (faY[i] > plotBaseLocation + srh3d.getPlotHeight()) {
          faY[i]=plotBaseLocation + srh3d.getPlotHeight();
        }
      }
    }
  }
  if (!bRendering3D) {
    handleOutsideDataPoints(ipr,srh,faX,faY,bShowAsTape);
  }
  if (ls.isCurve()) {
    renderAsCurve(ipr,ls.getLineAttributes(),bRendering3D ? (ISeriesRenderingHints)srh3d : srh,bRendering3D ? goFactory.createLocation3Ds(faX,faY,faZ) : goFactory.createLocations(faX,faY),bShowAsTape,dTapeWidth,fPaletteEntry,ls.isPaletteLineColor());
    renderShadowAsCurve(ipr,lia,bRendering3D ? (ISeriesRenderingHints)srh3d : srh,bRendering3D ? goFactory.createLocation3Ds(faX,faY,faZ) : goFactory.createLocations(faX,faY),bShowAsTape,dTapeWidth);
    if (m != null) {
      for (int i=0; i < dpha.length; i++) {
        if (dpha[i].isOutside()) {
          continue;
        }
        if (bPaletteByCategory) {
          fPaletteEntry=FillUtil.getPaletteFill(elPalette,i);
        }
 else {
          fPaletteEntry=FillUtil.getPaletteFill(elPalette,iThisSeriesIndex);
        }
        updateTranslucency(fPaletteEntry,ls);
        ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_ELEMENT,dpha[i],fPaletteEntry);
        ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_DATA_POINT,dpha[i],fPaletteEntry,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_ELEMENT,dpha[i]);
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_DATA_POINT,dpha[i]);
        renderMarker(ls,ipr,m,bRendering3D ? goFactory.createLocation3D(faX[i],faY[i],faZ[i]) : goFactory.createLocation(faX[i],faY[i]),ls.getLineAttributes(),fPaletteEntry,dpha[i],null,true,true);
        ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_ELEMENT,dpha[i],fPaletteEntry);
        ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_DATA_POINT,dpha[i],fPaletteEntry,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_ELEMENT,dpha[i]);
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_DATA_POINT,dpha[i]);
      }
    }
  }
 else {
    renderShadow(ipr,p,lia,bRendering3D ? goFactory.createLocation3Ds(faX,faY,faZ) : goFactory.createLocations(faX,faY),bShowAsTape,dpha);
    renderDataPoints(ipr,p,bRendering3D ? (ISeriesRenderingHints)srh3d : srh,dpha,lia,bRendering3D ? goFactory.createLocation3Ds(faX,faY,faZ) : goFactory.createLocations(faX,faY),bShowAsTape,dTapeWidth,fPaletteEntry,ls.isPaletteLineColor());
    if (m != null) {
      for (int i=0; i < dpha.length; i++) {
        if (bPaletteByCategory) {
          fPaletteEntry=FillUtil.getPaletteFill(elPalette,i);
        }
 else {
          fPaletteEntry=FillUtil.getPaletteFill(elPalette,iThisSeriesIndex);
        }
        updateTranslucency(fPaletteEntry,ls);
        ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_ELEMENT,dpha[i],fPaletteEntry);
        ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_DATA_POINT,dpha[i],fPaletteEntry,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_ELEMENT,dpha[i]);
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_DATA_POINT,dpha[i]);
        renderMarker(ls,ipr,m,bRendering3D ? goFactory.createLocation3D(faX[i],faY[i],faZ[i]) : goFactory.createLocation(faX[i],faY[i]),ls.getLineAttributes(),fPaletteEntry,dpha[i],null,true,true);
        ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_ELEMENT,dpha[i],fPaletteEntry);
        ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_DATA_POINT,dpha[i],fPaletteEntry,getRunTimeContext().getScriptContext());
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_ELEMENT,dpha[i]);
        getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_DATA_POINT,dpha[i]);
      }
    }
  }
  Label laDataPoint=null;
  Position pDataPoint=null;
  Location loDataPoint=null;
  Location3D loDataPoint3d=null;
  try {
    if (bRendering3D) {
      laDataPoint=srh3d.getLabelAttributes(ls);
      if (laDataPoint.isVisible()) {
        pDataPoint=srh3d.getLabelPosition(ls);
        loDataPoint3d=goFactory.createLocation3D(0,0,0);
      }
    }
 else {
      laDataPoint=srh.getLabelAttributes(ls);
      if (laDataPoint.isVisible()) {
        pDataPoint=srh.getLabelPosition(ls);
        loDataPoint=goFactory.createLocation(0,0);
      }
    }
  }
 catch (  Exception ex) {
    throw new ChartException(ChartEngineExtensionPlugin.ID,ChartException.RENDERING,ex);
  }
  if (laDataPoint.isVisible()) {
    final double dSize=m == null ? 0 : m.getSize();
    for (int i=0; i < dpha.length; i++) {
      if (isNaN(dpha[i].getOrthogonalValue()) || dpha[i].isOutside()) {
        continue;
      }
      laDataPoint=bRendering3D ? srh3d.getLabelAttributes(ls) : srh.getLabelAttributes(ls);
      laDataPoint.getCaption().setValue(dpha[i].getDisplayValue());
      ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_DATA_POINT_LABEL,dpha[i],laDataPoint,getRunTimeContext().getScriptContext());
      getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_DATA_POINT_LABEL,laDataPoint);
      if (laDataPoint.isVisible()) {
        if (bRendering3D) {
switch (pDataPoint.getValue()) {
case Position.ABOVE:
            loDataPoint3d.set(faX[i],faY[i] + dSize + p.getVerticalSpacing(),faZ[i] + 1);
          break;
case Position.BELOW:
        loDataPoint3d.set(faX[i],faY[i] - dSize - p.getVerticalSpacing(),faZ[i] + 1);
      break;
case Position.LEFT:
    loDataPoint3d.set(faX[i] - dSize - p.getHorizontalSpacing(),faY[i],faZ[i] + 1);
  break;
case Position.RIGHT:
loDataPoint3d.set(faX[i] + dSize + p.getHorizontalSpacing(),faY[i],faZ[i] + 1);
break;
default :
throw new ChartException(ChartEngineExtensionPlugin.ID,ChartException.RENDERING,"String_Node_Str",new Object[]{pDataPoint.getName()},Messages.getResourceBundle(getRunTimeContext().getULocale()));
}
final Text3DRenderEvent tre3d=((EventObjectCache)ipr).getEventObject(WrappedStructureSource.createSeriesDataPoint(ls,dpha[i]),Text3DRenderEvent.class);
tre3d.setAction(TextRenderEvent.RENDER_TEXT_AT_LOCATION);
tre3d.setLabel(laDataPoint);
tre3d.setTextPosition(Methods.getLabelPosition(pDataPoint));
tre3d.setLocation3D(loDataPoint3d);
getDeferredCache().addLabel(tre3d);
}
 else {
switch (pDataPoint.getValue()) {
case Position.ABOVE:
loDataPoint.set(faX[i],faY[i] - dSize - p.getVerticalSpacing());
break;
case Position.BELOW:
loDataPoint.set(faX[i],faY[i] + dSize + p.getVerticalSpacing());
break;
case Position.LEFT:
loDataPoint.set(faX[i] - dSize - p.getHorizontalSpacing(),faY[i]);
break;
case Position.RIGHT:
loDataPoint.set(faX[i] + dSize + p.getHorizontalSpacing(),faY[i]);
break;
default :
throw new ChartException(ChartEngineExtensionPlugin.ID,ChartException.RENDERING,"String_Node_Str",new Object[]{pDataPoint.getName()},Messages.getResourceBundle(getRunTimeContext().getULocale()));
}
renderLabel(WrappedStructureSource.createSeriesDataPoint(ls,dpha[i]),TextRenderEvent.RENDER_TEXT_AT_LOCATION,laDataPoint,pDataPoint,loDataPoint,null);
}
}
ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_DATA_POINT_LABEL,dpha[i],laDataPoint,getRunTimeContext().getScriptContext());
getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_DATA_POINT_LABEL,laDataPoint);
}
}
if (!bRendering3D && getSeries().getCurveFitting() != null) {
Location[] larray=new Location[faX.length];
for (int i=0; i < larray.length; i++) {
larray[i]=goFactory.createLocation(faX[i],faY[i]);
}
larray=filterNull(larray,isrh.getDataPoints());
renderFittingCurve(ipr,larray,getSeries().getCurveFitting(),false,true);
}
if (!bRendering3D) {
restoreClipping(ipr);
}
}