Program: 75301
Project: 75301
Buggy source:
/** 
 * Calculates visibility for axis labels.
 * @param xs
 * @param la
 * @param iLabelLocation
 * @return
 * @throws ChartException
 */
final protected boolean[] checkTickLabelsVisibility(IDisplayServer xs,Label la,int iLabelLocation) throws ChartException {
  boolean[] ba=new boolean[atcTickCoordinates.size()];
  boolean vis=la.isSetVisible() && la.isVisible();
  Arrays.fill(ba,vis);
  baTickLabelStaggered=new boolean[atcTickCoordinates.size()];
  boolean staggerEnabled=isAxisLabelStaggered();
  if (!vis) {
    return ba;
  }
  if (iLabelShowingInterval >= 2) {
    for (int i=0, c=0; i < ba.length; i++) {
      ba[i]=(i % iLabelShowingInterval == 0);
      if (staggerEnabled && ba[i]) {
        c++;
        baTickLabelStaggered[i]=(c % 2 == 0);
      }
    }
  }
 else {
    if (staggerEnabled) {
      for (int i=0; i < ba.length; i++) {
        baTickLabelStaggered[i]=(i % 2 != 0);
      }
    }
  }
  if (!isCategoryScale()) {
    return ba;
  }
  final double dAngleInDegrees=la.getCaption().getFont().getRotation();
  double x=0, y=0;
  int iNewPointToCheck=0, iPrevPointToCheck=0;
  boolean isNegativeRotation=(dAngleInDegrees < 0 && dAngleInDegrees > -90);
switch (iLabelLocation) {
case ABOVE:
    iNewPointToCheck=isNegativeRotation ? 3 : 0;
  iPrevPointToCheck=isNegativeRotation ? 1 : 3;
break;
case BELOW:
iNewPointToCheck=isNegativeRotation ? (iScaleDirection == BACKWARD ? 1 : 3) : (iScaleDirection == BACKWARD ? 2 : 0);
iPrevPointToCheck=isNegativeRotation ? (iScaleDirection == BACKWARD ? 2 : 0) : (iScaleDirection == BACKWARD ? 0 : 2);
break;
case LEFT:
iNewPointToCheck=iScaleDirection == FORWARD ? 1 : 2;
iPrevPointToCheck=iScaleDirection == FORWARD ? 2 : 1;
break;
case RIGHT:
iNewPointToCheck=iScaleDirection == FORWARD ? 0 : 3;
iPrevPointToCheck=iScaleDirection == FORWARD ? 3 : 0;
break;
}
RotatedRectangle rrPrev[]=new RotatedRectangle[2];
DataSetIterator dsi=getData();
dsi.reset();
final int iDateTimeUnit=(iType == IConstants.DATE_TIME) ? CDateTime.computeUnit(dsi) : IConstants.UNDEFINED;
String sText=null;
dsi.reset();
for (int i=0; i < atcTickCoordinates.size() - 1; i++) {
Object oValue=null;
if (dsi.hasNext()) {
oValue=dsi.next();
}
if (ba[i]) {
sText=formatCategoryValue(iType,oValue,iDateTimeUnit);
if (iLabelLocation == ABOVE || iLabelLocation == BELOW) {
x=this.atcTickCoordinates.getCoordinate(i) * dZoomFactor;
}
 else if (iLabelLocation == LEFT || iLabelLocation == RIGHT) {
y=this.atcTickCoordinates.getCoordinate(i) * dZoomFactor;
}
la.getCaption().setValue(sText);
if (isAxisLabelStaggered() && baTickLabelStaggered[i]) {
ba[i]=checkOneTickLabelVisibility(rrPrev,1,iLabelLocation,x,y,iNewPointToCheck,iPrevPointToCheck,la,xs,i);
}
 else {
ba[i]=checkOneTickLabelVisibility(rrPrev,0,iLabelLocation,x,y,iNewPointToCheck,iPrevPointToCheck,la,xs,i);
}
}
}
return ba;
}

Fixed version (ground truth):
/** 
 * Calculates visibility for axis labels.
 * @param xs
 * @param la
 * @param iLabelLocation
 * @return
 * @throws ChartException
 */
final protected boolean[] checkTickLabelsVisibility(IDisplayServer xs,Label la,int iLabelLocation) throws ChartException {
  boolean[] ba=new boolean[atcTickCoordinates.size()];
  boolean vis=la.isSetVisible() && la.isVisible();
  Arrays.fill(ba,vis);
  baTickLabelStaggered=new boolean[atcTickCoordinates.size()];
  boolean staggerEnabled=isAxisLabelStaggered();
  if (!vis) {
    return ba;
  }
  if (iLabelShowingInterval >= 2) {
    for (int i=0, c=0; i < ba.length; i++) {
      ba[i]=(i % iLabelShowingInterval == 0);
      if (staggerEnabled && ba[i]) {
        c++;
        baTickLabelStaggered[i]=(c % 2 == 0);
      }
    }
  }
 else {
    if (staggerEnabled) {
      for (int i=0; i < ba.length; i++) {
        baTickLabelStaggered[i]=(i % 2 != 0);
      }
    }
  }
  if (!isCategoryScale()) {
    return ba;
  }
  final double dAngleInDegrees=la.getCaption().getFont().getRotation();
  double x=0, y=0;
  int iNewPointToCheck=0, iPrevPointToCheck=0;
  boolean isNegativeRotation=(dAngleInDegrees < 0 && dAngleInDegrees > -90);
switch (iLabelLocation) {
case ABOVE:
    iNewPointToCheck=isNegativeRotation ? 3 : 0;
  iPrevPointToCheck=isNegativeRotation ? 1 : 3;
break;
case BELOW:
iNewPointToCheck=isNegativeRotation ? (iScaleDirection == BACKWARD ? 1 : 3) : (iScaleDirection == BACKWARD ? 2 : 0);
iPrevPointToCheck=isNegativeRotation ? (iScaleDirection == BACKWARD ? 2 : 0) : (iScaleDirection == BACKWARD ? 0 : 2);
break;
case LEFT:
iNewPointToCheck=iScaleDirection == FORWARD ? 1 : 2;
iPrevPointToCheck=iScaleDirection == FORWARD ? 2 : 1;
break;
case RIGHT:
iNewPointToCheck=iScaleDirection == FORWARD ? 0 : 3;
iPrevPointToCheck=iScaleDirection == FORWARD ? 3 : 0;
break;
}
RotatedRectangle rrPrev[]=new RotatedRectangle[2];
DataSetIterator dsi=getData();
dsi.reset();
final int iDateTimeUnit=(iType == IConstants.DATE_TIME) ? CDateTime.computeUnit(dsi) : IConstants.UNDEFINED;
String sText=null;
dsi.reset();
for (int i=0; i < atcTickCoordinates.size() - 1; i++) {
if (!isTickBetweenCategories() && i == 0) {
continue;
}
Object oValue=null;
if (dsi.hasNext()) {
oValue=dsi.next();
}
if (ba[i]) {
sText=formatCategoryValue(iType,oValue,iDateTimeUnit);
if (iLabelLocation == ABOVE || iLabelLocation == BELOW) {
x=this.atcTickCoordinates.getCoordinate(i) * dZoomFactor;
}
 else if (iLabelLocation == LEFT || iLabelLocation == RIGHT) {
y=this.atcTickCoordinates.getCoordinate(i) * dZoomFactor;
}
la.getCaption().setValue(sText);
if (isAxisLabelStaggered() && baTickLabelStaggered[i]) {
ba[i]=checkOneTickLabelVisibility(rrPrev,1,iLabelLocation,x,y,iNewPointToCheck,iPrevPointToCheck,la,xs,i);
}
 else {
ba[i]=checkOneTickLabelVisibility(rrPrev,0,iLabelLocation,x,y,iNewPointToCheck,iPrevPointToCheck,la,xs,i);
}
}
}
return ba;
}