Program: 171189
Project: 171189
Buggy source:
private void drawAxis(){
  if (Double.compare(stepSize,0) <= 0)   return;
  axisCtx.clearRect(0,0,width,height);
  axisCtx.setFill(getAxisBackgroundColor());
  axisCtx.fillRect(0,0,width,height);
  axisCtx.setFont(tickLabelFont);
  axisCtx.setTextBaseline(VPos.CENTER);
  AxisType axisType=getType();
  boolean isAutoScale=isAutoScale();
  double minValue=getMinValue();
  double maxValue=getMaxValue();
  boolean tickLabelsVisible=getTickLabelsVisible();
  boolean isOnlyFirstAndLastTickLabelVisible=isOnlyFirstAndLastTickLabelVisible();
  double tickLabelFontSize=getTickLabelFontSize();
  TickLabelFormat tickLabelFormat=getTickLabelFormat();
  Color tickLabelColor=getTickLabelColor();
  Color zeroColor=getZeroColor();
  Color majorTickMarkColor=getMajorTickMarkColor();
  boolean majorTickMarksVisible=getMajorTickMarksVisible();
  Color mediumTickMarkColor=getMediumTickMarkColor();
  boolean mediumTickMarksVisible=getMediumTickMarksVisible();
  Color minorTickMarkColor=getMinorTickMarkColor();
  boolean minorTickMarksVisible=getMinorTickMarksVisible();
  double majorLineWidth=size * 0.007 < MIN_MAJOR_LINE_WIDTH ? MIN_MAJOR_LINE_WIDTH : size * 0.007;
  double mediumLineWidth=size * 0.006 < MIN_MEDIUM_LINE_WIDTH ? MIN_MEDIUM_LINE_WIDTH : size * 0.005;
  double minorLineWidth=size * 0.005 < MIN_MINOR_LINE_WIDTH ? MIN_MINOR_LINE_WIDTH : size * 0.003;
  double maxMajorTickMarkLength;
  double maxMediumTickMarkLength;
  double maxMinorTickMarkLength;
  double textPosition;
  double minPosition;
  double maxPosition;
  if (VERTICAL == getOrientation()) {
    minPosition=0;
    maxPosition=height;
    textPosition=width * 0.3;
    maxMajorTickMarkLength=width * 0.2;
    maxMediumTickMarkLength=width * 0.175;
    maxMinorTickMarkLength=width * 0.1;
  }
 else {
    minPosition=0;
    maxPosition=width;
    textPosition=height * 0.5;
    maxMajorTickMarkLength=height * 0.2;
    maxMediumTickMarkLength=height * 0.175;
    maxMinorTickMarkLength=height * 0.1;
  }
  Locale locale=getLocale();
  Orientation orientation=getOrientation();
  Position position=getPosition();
  double anchorX=Position.LEFT == position ? 0 : getZeroPosition();
  double anchorXPlusOffset=anchorX + width;
  double anchorY=Position.BOTTOM == position ? 0 : getZeroPosition();
  double anchorYPlusOffset=anchorY + height;
  boolean isMinValue;
  boolean isZero;
  boolean isMaxValue;
  double innerPointX;
  double innerPointY;
  double outerPointX;
  double outerPointY;
  double mediumPointX;
  double mediumPointY;
  double minorPointX;
  double minorPointY;
  double textPointX;
  double textPointY;
  double maxTextWidth;
  if (AxisType.LINEAR == axisType || AxisType.TEXT == axisType) {
    boolean fullRange=(minValue < 0 && maxValue > 0);
    double minorTickSpace=getMinorTickSpace();
    double majorTickSpace=getMajorTickSpace();
    double tmpStepSize=minorTickSpace;
    BigDecimal minorTickSpaceBD=BigDecimal.valueOf(minorTickSpace);
    BigDecimal majorTickSpaceBD=BigDecimal.valueOf(majorTickSpace);
    BigDecimal mediumCheck2=BigDecimal.valueOf(2 * minorTickSpace);
    BigDecimal mediumCheck5=BigDecimal.valueOf(5 * minorTickSpace);
    BigDecimal counterBD=BigDecimal.valueOf(minValue);
    double counter=minValue;
    double range=getRange();
    int noOfCategories=categories.size();
    axisCtx.setStroke(getAxisColor());
    axisCtx.setLineWidth(majorLineWidth);
    if (VERTICAL == orientation) {
switch (position) {
case LEFT:
        axisCtx.strokeLine(anchorXPlusOffset,minPosition,anchorXPlusOffset,maxPosition);
      break;
case RIGHT:
    axisCtx.strokeLine(anchorX,minPosition,anchorX,maxPosition);
  break;
default :
axisCtx.strokeLine(anchorX,minPosition,anchorX,maxPosition);
break;
}
}
 else {
switch (position) {
case BOTTOM:
axisCtx.strokeLine(minPosition,anchorY,maxPosition,anchorY);
break;
case TOP:
axisCtx.strokeLine(minPosition,anchorYPlusOffset,maxPosition,anchorYPlusOffset);
break;
default :
axisCtx.strokeLine(minPosition,anchorY,maxPosition,anchorY);
break;
}
}
BigDecimal tmpStepBD=new BigDecimal(tmpStepSize);
tmpStepBD=tmpStepBD.setScale(6,BigDecimal.ROUND_HALF_UP);
double tmpStep=tmpStepBD.doubleValue();
int tickMarkCounter=0;
int tickLabelCounter=0;
for (double i=0; Double.compare(-range - tmpStep,i) <= 0; i-=tmpStep) {
double fixedPosition=(counter - minValue) * stepSize;
if (VERTICAL == orientation) {
if (Position.LEFT == position) {
innerPointX=anchorXPlusOffset - maxMajorTickMarkLength;
innerPointY=fixedPosition;
mediumPointX=anchorXPlusOffset - maxMediumTickMarkLength;
mediumPointY=fixedPosition;
minorPointX=anchorXPlusOffset - maxMinorTickMarkLength;
minorPointY=fixedPosition;
outerPointX=anchorXPlusOffset;
outerPointY=fixedPosition;
textPointX=anchorXPlusOffset - textPosition;
textPointY=fixedPosition;
maxTextWidth=0.6 * width;
}
 else if (Position.RIGHT == position) {
innerPointX=anchorX + maxMajorTickMarkLength;
innerPointY=fixedPosition;
mediumPointX=anchorX + maxMediumTickMarkLength;
mediumPointY=fixedPosition;
minorPointX=anchorX + maxMinorTickMarkLength;
minorPointY=fixedPosition;
outerPointX=anchorX;
outerPointY=fixedPosition;
textPointX=anchorXPlusOffset;
textPointY=fixedPosition;
maxTextWidth=textPosition;
}
 else {
innerPointX=anchorX - 0.25 * width;
innerPointY=fixedPosition;
mediumPointX=anchorX - 0.2 * width;
mediumPointY=fixedPosition;
minorPointX=anchorX - 0.15 * width;
minorPointY=fixedPosition;
outerPointX=anchorX;
outerPointY=fixedPosition;
textPointX=anchorXPlusOffset;
textPointY=fixedPosition;
maxTextWidth=textPosition;
}
}
 else {
if (Position.BOTTOM == position) {
innerPointX=fixedPosition;
innerPointY=anchorY + maxMajorTickMarkLength;
mediumPointX=fixedPosition;
mediumPointY=anchorY + maxMediumTickMarkLength;
minorPointX=fixedPosition;
minorPointY=anchorY + maxMinorTickMarkLength;
outerPointX=fixedPosition;
outerPointY=anchorY;
textPointX=fixedPosition;
textPointY=innerPointY + textPosition - tickLabelFontSize * 0.8;
maxTextWidth=majorTickSpace * stepSize;
}
 else if (Position.TOP == position) {
innerPointX=fixedPosition;
innerPointY=anchorYPlusOffset - maxMajorTickMarkLength;
mediumPointX=fixedPosition;
mediumPointY=anchorYPlusOffset - maxMediumTickMarkLength;
minorPointX=fixedPosition;
minorPointY=anchorYPlusOffset - maxMinorTickMarkLength;
outerPointX=fixedPosition;
outerPointY=anchorYPlusOffset;
textPointX=fixedPosition;
textPointY=innerPointY - textPosition + tickLabelFontSize * 0.5;
maxTextWidth=majorTickSpace * stepSize;
}
 else {
innerPointX=fixedPosition;
innerPointY=anchorY - 0.25 * height;
mediumPointX=fixedPosition;
mediumPointY=anchorY - 0.2 * height;
minorPointX=fixedPosition;
minorPointY=anchorY - 0.15 * height;
outerPointX=fixedPosition;
outerPointY=anchorY;
textPointX=fixedPosition;
textPointY=anchorY + 0.2 * height;
maxTextWidth=majorTickSpace * stepSize;
}
}
if (Double.compare(counterBD.setScale(12,BigDecimal.ROUND_HALF_UP).remainder(majorTickSpaceBD).doubleValue(),0.0) == 0) {
isMinValue=Double.compare(minValue,counter) == 0;
isMaxValue=Double.compare(maxValue,counter) == 0;
if (VERTICAL == orientation) {
isZero=Double.compare(0.0,maxValue - counter + minValue) == 0;
}
 else {
isZero=Double.compare(0.0,counter) == 0;
}
if (isZero) {
setZeroPosition(fixedPosition);
}
if (majorTickMarksVisible) {
drawTickMark((fullRange && isZero) ? zeroColor : majorTickMarkColor,majorLineWidth,innerPointX,innerPointY,outerPointX,outerPointY);
}
 else if (minorTickMarksVisible) {
drawTickMark((fullRange && isZero) ? zeroColor : minorTickMarkColor,minorLineWidth,minorPointX,minorPointY,outerPointX,outerPointY);
}
if (tickLabelsVisible && tickLabelFontSize > 6) {
String tickLabelString;
if (AxisType.LINEAR == axisType) {
if (TickLabelFormat.NUMBER == tickLabelFormat) {
tickLabelString=Orientation.HORIZONTAL == orientation ? String.format(locale,tickLabelFormatString,(minValue - i)) : String.format(locale,tickLabelFormatString,maxValue - counter + minValue);
}
 else {
tickLabelString=Orientation.HORIZONTAL == orientation ? Helper.secondsToHHMMString(Helper.toSeconds(Helper.toRealValue(minValue - i),Helper.getZoneOffset())) : String.format(locale,tickLabelFormatString,maxValue - counter + minValue);
}
}
 else if (AxisType.TEXT == axisType) {
if (tickLabelCounter < noOfCategories) {
tickLabelString=categories.get(tickLabelCounter);
}
 else {
tickLabelString="String_Node_Str";
}
if (isAutoScale) {
tickLabelCounter+=(int)majorTickSpace;
}
 else {
tickLabelCounter++;
}
}
 else {
tickLabelString=dateTimeFormatter.format(toLocalDateTime((long)(minValue - i) * 1000));
}
drawTickLabel(isOnlyFirstAndLastTickLabelVisible,isZero,isMinValue,isMaxValue,fullRange,zeroColor,tickLabelColor,textPointX,textPointY,maxTextWidth,tickLabelString,orientation);
}
}
 else if (mediumTickMarksVisible && Double.compare(minorTickSpaceBD.setScale(12,BigDecimal.ROUND_HALF_UP).remainder(mediumCheck2).doubleValue(),0.0) != 0.0 && Double.compare(counterBD.setScale(12,BigDecimal.ROUND_HALF_UP).remainder(mediumCheck5).doubleValue(),0.0) == 0.0) {
drawTickMark(mediumTickMarkColor,mediumLineWidth,mediumPointX,mediumPointY,outerPointX,outerPointY);
}
 else if (minorTickMarksVisible && Double.compare(counterBD.setScale(12,BigDecimal.ROUND_HALF_UP).remainder(minorTickSpaceBD).doubleValue(),0.0) == 0) {
drawTickMark(minorTickMarkColor,minorLineWidth,minorPointX,minorPointY,outerPointX,outerPointY);
}
 else if (!isAutoScale && tickMarkCounter % 10 == 0) {
isMinValue=Double.compare(minValue,counter) == 0;
isMaxValue=Double.compare(maxValue,counter) == 0;
if (VERTICAL == orientation) {
isZero=Double.compare(0.0,maxValue - counter + minValue) == 0;
}
 else {
isZero=Double.compare(0.0,counter) == 0;
}
if (isZero) {
setZeroPosition(fixedPosition);
}
drawTickMark((fullRange && isZero) ? zeroColor : minorTickMarkColor,minorLineWidth,innerPointX,innerPointY,outerPointX,outerPointY);
if (tickLabelsVisible) {
String tickLabelString;
if (TickLabelFormat.NUMBER == getTickLabelFormat()) {
tickLabelString=Orientation.HORIZONTAL == orientation ? String.format(locale,tickLabelFormatString,(minValue - i)) : String.format(locale,tickLabelFormatString,maxValue - counter + minValue);
}
 else {
tickLabelString=Orientation.HORIZONTAL == orientation ? Helper.secondsToHHMMString(Helper.toSeconds(Helper.toRealValue(minValue - i),Helper.getZoneOffset())) : String.format(locale,tickLabelFormatString,maxValue - counter + minValue);
}
drawTickLabel(isOnlyFirstAndLastTickLabelVisible,isZero,isMinValue,isMaxValue,fullRange,zeroColor,tickLabelColor,textPointX,textPointY,maxTextWidth,tickLabelString,orientation);
}
}
 else if (tickMarkCounter % 1 == 0) {
drawTickMark(minorTickMarkColor,minorLineWidth,minorPointX,minorPointY,outerPointX,outerPointY);
}
counterBD=counterBD.add(minorTickSpaceBD);
counter=counterBD.doubleValue();
if (counter > maxValue) break;
}
}
 else if (AxisType.LOGARITHMIC == axisType) {
tickLabelFormatString="String_Node_Str";
double logLowerBound=Math.log10(getMinValue());
double logUpperBound=Math.log10(getMaxValue());
double section;
if (VERTICAL == orientation) {
section=height / logUpperBound;
if (Position.LEFT == position) {
axisCtx.strokeLine(anchorXPlusOffset,minPosition,anchorXPlusOffset,maxPosition);
}
 else if (Position.RIGHT == position) {
axisCtx.strokeLine(anchorX,minPosition,anchorX,maxPosition);
}
}
 else {
section=width / logUpperBound;
if (Position.BOTTOM == position) {
axisCtx.strokeLine(minPosition,anchorY,maxPosition,anchorY);
}
 else if (Position.TOP == position) {
axisCtx.strokeLine(minPosition,anchorYPlusOffset,maxPosition,anchorYPlusOffset);
}
}
for (double i=0; i <= logUpperBound; i+=1) {
for (double j=1; j <= 9; j++) {
BigDecimal value=new BigDecimal(j * Math.pow(10,i));
double stepSize=i > 0 ? (Math.log10(value.doubleValue()) % i) : Math.log10(value.doubleValue());
double fixedPosition;
if (VERTICAL == orientation) {
isMinValue=Double.compare(i,logUpperBound) == 0;
isMaxValue=i == 0;
fixedPosition=maxPosition - i * section - (stepSize * section);
if (Position.LEFT == position) {
innerPointX=anchorXPlusOffset - maxMajorTickMarkLength;
innerPointY=fixedPosition;
minorPointX=anchorXPlusOffset - maxMinorTickMarkLength;
minorPointY=fixedPosition;
outerPointX=anchorXPlusOffset;
outerPointY=fixedPosition;
textPointX=anchorXPlusOffset - textPosition;
textPointY=fixedPosition;
maxTextWidth=0.6 * width;
}
 else {
innerPointX=anchorX + maxMajorTickMarkLength;
innerPointY=fixedPosition;
minorPointX=anchorX + maxMinorTickMarkLength;
minorPointY=fixedPosition;
outerPointX=anchorX;
outerPointY=fixedPosition;
textPointX=anchorXPlusOffset;
textPointY=fixedPosition;
maxTextWidth=width;
}
}
 else {
isMinValue=i == 0;
isMaxValue=Double.compare(i,logUpperBound) == 0;
fixedPosition=i * section + (stepSize * section);
if (Position.BOTTOM == position) {
innerPointX=fixedPosition;
innerPointY=anchorY + maxMajorTickMarkLength;
minorPointX=fixedPosition;
minorPointY=anchorY + maxMinorTickMarkLength;
outerPointX=fixedPosition;
outerPointY=anchorY;
textPointX=fixedPosition;
textPointY=anchorY + textPosition - tickLabelFontSize * 0.2;
maxTextWidth=section;
}
 else {
innerPointX=fixedPosition;
innerPointY=anchorYPlusOffset - maxMajorTickMarkLength;
minorPointX=fixedPosition;
minorPointY=anchorYPlusOffset - maxMinorTickMarkLength;
outerPointX=fixedPosition;
outerPointY=anchorYPlusOffset;
textPointX=fixedPosition;
textPointY=anchorY - textPosition + tickLabelFontSize * 0.5;
maxTextWidth=section;
}
}
if (Helper.isPowerOf10(value.intValue())) {
if (majorTickMarksVisible) {
drawTickMark(majorTickMarkColor,majorLineWidth,innerPointX,innerPointY,outerPointX,outerPointY);
}
 else if (minorTickMarksVisible) {
drawTickMark(minorTickMarkColor,minorLineWidth,minorPointX,minorPointY,outerPointX,outerPointY);
}
if (tickLabelsVisible) {
axisCtx.setFill(tickLabelColor);
if (VERTICAL == orientation) {
axisCtx.setTextAlign(TextAlignment.RIGHT);
}
drawTickLabel(isOnlyFirstAndLastTickLabelVisible,false,isMinValue,isMaxValue,false,zeroColor,tickLabelColor,textPointX,textPointY,maxTextWidth,String.format(locale,tickLabelFormatString,value),orientation);
}
}
 else {
if (minorTickMarksVisible) {
drawTickMark(minorTickMarkColor,minorLineWidth,minorPointX,minorPointY,outerPointX,outerPointY);
}
}
}
}
}
drawAxisTitle(orientation,position);
}

Fixed version (ground truth):
private void drawAxis(){
  if (Double.compare(stepSize,0) <= 0)   return;
  axisCtx.clearRect(0,0,width,height);
  axisCtx.setFill(getAxisBackgroundColor());
  axisCtx.fillRect(0,0,width,height);
  axisCtx.setFont(tickLabelFont);
  axisCtx.setTextBaseline(VPos.CENTER);
  AxisType axisType=getType();
  boolean isAutoScale=isAutoScale();
  double minValue=getMinValue();
  double maxValue=getMaxValue();
  boolean tickLabelsVisible=getTickLabelsVisible();
  boolean isOnlyFirstAndLastTickLabelVisible=isOnlyFirstAndLastTickLabelVisible();
  double tickLabelFontSize=getTickLabelFontSize();
  TickLabelFormat tickLabelFormat=getTickLabelFormat();
  Color tickLabelColor=getTickLabelColor();
  Color zeroColor=getZeroColor();
  Color majorTickMarkColor=getMajorTickMarkColor();
  boolean majorTickMarksVisible=getMajorTickMarksVisible();
  Color mediumTickMarkColor=getMediumTickMarkColor();
  boolean mediumTickMarksVisible=getMediumTickMarksVisible();
  Color minorTickMarkColor=getMinorTickMarkColor();
  boolean minorTickMarksVisible=getMinorTickMarksVisible();
  double majorLineWidth=size * 0.007 < MIN_MAJOR_LINE_WIDTH ? MIN_MAJOR_LINE_WIDTH : size * 0.007;
  double mediumLineWidth=size * 0.006 < MIN_MEDIUM_LINE_WIDTH ? MIN_MEDIUM_LINE_WIDTH : size * 0.005;
  double minorLineWidth=size * 0.005 < MIN_MINOR_LINE_WIDTH ? MIN_MINOR_LINE_WIDTH : size * 0.003;
  double maxMajorTickMarkLength;
  double maxMediumTickMarkLength;
  double maxMinorTickMarkLength;
  double textPosition;
  double minPosition;
  double maxPosition;
  if (VERTICAL == getOrientation()) {
    minPosition=0;
    maxPosition=height;
    textPosition=width * 0.3;
    maxMajorTickMarkLength=width * 0.2;
    maxMediumTickMarkLength=width * 0.175;
    maxMinorTickMarkLength=width * 0.1;
  }
 else {
    minPosition=0;
    maxPosition=width;
    textPosition=height * 0.5;
    maxMajorTickMarkLength=height * 0.2;
    maxMediumTickMarkLength=height * 0.175;
    maxMinorTickMarkLength=height * 0.1;
  }
  Locale locale=getLocale();
  Orientation orientation=getOrientation();
  Position position=getPosition();
  double anchorX=(Position.LEFT == position || Position.CENTER == position) ? 0 : getZeroPosition();
  double anchorXPlusOffset=anchorX + width;
  double anchorY=(Position.BOTTOM == position || Position.CENTER == position) ? 0 : getZeroPosition();
  double anchorYPlusOffset=anchorY + height;
  boolean isMinValue;
  boolean isZero;
  boolean isMaxValue;
  double innerPointX;
  double innerPointY;
  double outerPointX;
  double outerPointY;
  double mediumPointX;
  double mediumPointY;
  double minorPointX;
  double minorPointY;
  double textPointX;
  double textPointY;
  double maxTextWidth;
  if (AxisType.LINEAR == axisType || AxisType.TEXT == axisType) {
    boolean fullRange=(minValue < 0 && maxValue > 0);
    double minorTickSpace=getMinorTickSpace();
    double majorTickSpace=getMajorTickSpace();
    double tmpStepSize=minorTickSpace;
    BigDecimal minorTickSpaceBD=BigDecimal.valueOf(minorTickSpace);
    BigDecimal majorTickSpaceBD=BigDecimal.valueOf(majorTickSpace);
    BigDecimal mediumCheck2=BigDecimal.valueOf(2 * minorTickSpace);
    BigDecimal mediumCheck5=BigDecimal.valueOf(5 * minorTickSpace);
    BigDecimal counterBD=BigDecimal.valueOf(minValue);
    double counter=minValue;
    double range=getRange();
    int noOfCategories=categories.size();
    axisCtx.setStroke(getAxisColor());
    axisCtx.setLineWidth(majorLineWidth);
    if (VERTICAL == orientation) {
switch (position) {
case LEFT:
        axisCtx.strokeLine(anchorXPlusOffset,minPosition,anchorXPlusOffset,maxPosition);
      break;
case RIGHT:
    axisCtx.strokeLine(anchorX,minPosition,anchorX,maxPosition);
  break;
default :
axisCtx.strokeLine(anchorX,minPosition,anchorX,maxPosition);
break;
}
}
 else {
switch (position) {
case BOTTOM:
axisCtx.strokeLine(minPosition,anchorY,maxPosition,anchorY);
break;
case TOP:
axisCtx.strokeLine(minPosition,anchorYPlusOffset,maxPosition,anchorYPlusOffset);
break;
default :
axisCtx.strokeLine(minPosition,anchorY,maxPosition,anchorY);
break;
}
}
BigDecimal tmpStepBD=new BigDecimal(tmpStepSize);
tmpStepBD=tmpStepBD.setScale(6,BigDecimal.ROUND_HALF_UP);
double tmpStep=tmpStepBD.doubleValue();
int tickMarkCounter=0;
int tickLabelCounter=0;
for (double i=0; Double.compare(-range - tmpStep,i) <= 0; i-=tmpStep) {
double fixedPosition=(counter - minValue) * stepSize;
if (VERTICAL == orientation) {
if (Position.LEFT == position) {
innerPointX=anchorXPlusOffset - maxMajorTickMarkLength;
innerPointY=fixedPosition;
mediumPointX=anchorXPlusOffset - maxMediumTickMarkLength;
mediumPointY=fixedPosition;
minorPointX=anchorXPlusOffset - maxMinorTickMarkLength;
minorPointY=fixedPosition;
outerPointX=anchorXPlusOffset;
outerPointY=fixedPosition;
textPointX=anchorXPlusOffset - textPosition;
textPointY=fixedPosition;
maxTextWidth=0.6 * width;
}
 else if (Position.RIGHT == position) {
innerPointX=anchorX + maxMajorTickMarkLength;
innerPointY=fixedPosition;
mediumPointX=anchorX + maxMediumTickMarkLength;
mediumPointY=fixedPosition;
minorPointX=anchorX + maxMinorTickMarkLength;
minorPointY=fixedPosition;
outerPointX=anchorX;
outerPointY=fixedPosition;
textPointX=anchorXPlusOffset;
textPointY=fixedPosition;
maxTextWidth=textPosition;
}
 else {
innerPointX=anchorX + maxMajorTickMarkLength;
innerPointY=fixedPosition;
mediumPointX=anchorX + maxMediumTickMarkLength;
mediumPointY=fixedPosition;
minorPointX=anchorX + maxMinorTickMarkLength;
minorPointY=fixedPosition;
outerPointX=anchorX;
outerPointY=fixedPosition;
textPointX=anchorXPlusOffset;
textPointY=fixedPosition;
maxTextWidth=textPosition;
}
}
 else {
if (Position.BOTTOM == position) {
innerPointX=fixedPosition;
innerPointY=anchorY + maxMajorTickMarkLength;
mediumPointX=fixedPosition;
mediumPointY=anchorY + maxMediumTickMarkLength;
minorPointX=fixedPosition;
minorPointY=anchorY + maxMinorTickMarkLength;
outerPointX=fixedPosition;
outerPointY=anchorY;
textPointX=fixedPosition;
textPointY=innerPointY + textPosition - tickLabelFontSize * 0.8;
maxTextWidth=majorTickSpace * stepSize;
}
 else if (Position.TOP == position) {
innerPointX=fixedPosition;
innerPointY=anchorYPlusOffset - maxMajorTickMarkLength;
mediumPointX=fixedPosition;
mediumPointY=anchorYPlusOffset - maxMediumTickMarkLength;
minorPointX=fixedPosition;
minorPointY=anchorYPlusOffset - maxMinorTickMarkLength;
outerPointX=fixedPosition;
outerPointY=anchorYPlusOffset;
textPointX=fixedPosition;
textPointY=innerPointY - textPosition + tickLabelFontSize * 0.5;
maxTextWidth=majorTickSpace * stepSize;
}
 else {
innerPointX=fixedPosition;
innerPointY=anchorY + maxMajorTickMarkLength;
mediumPointX=fixedPosition;
mediumPointY=anchorY + maxMediumTickMarkLength;
minorPointX=fixedPosition;
minorPointY=anchorY + maxMinorTickMarkLength;
outerPointX=fixedPosition;
outerPointY=anchorY;
textPointX=fixedPosition;
textPointY=innerPointY + textPosition - tickLabelFontSize * 0.8;
maxTextWidth=majorTickSpace * stepSize;
}
}
if (Double.compare(counterBD.setScale(12,BigDecimal.ROUND_HALF_UP).remainder(majorTickSpaceBD).doubleValue(),0.0) == 0) {
isMinValue=Double.compare(minValue,counter) == 0;
isMaxValue=Double.compare(maxValue,counter) == 0;
if (VERTICAL == orientation) {
isZero=Double.compare(0.0,maxValue - counter + minValue) == 0;
}
 else {
isZero=Double.compare(0.0,counter) == 0;
}
if (isZero) {
setZeroPosition(fixedPosition);
}
if (majorTickMarksVisible) {
drawTickMark((fullRange && isZero) ? zeroColor : majorTickMarkColor,majorLineWidth,innerPointX,innerPointY,outerPointX,outerPointY);
}
 else if (minorTickMarksVisible) {
drawTickMark((fullRange && isZero) ? zeroColor : minorTickMarkColor,minorLineWidth,minorPointX,minorPointY,outerPointX,outerPointY);
}
if (tickLabelsVisible && tickLabelFontSize > 6) {
String tickLabelString;
if (AxisType.LINEAR == axisType) {
if (TickLabelFormat.NUMBER == tickLabelFormat) {
tickLabelString=Orientation.HORIZONTAL == orientation ? String.format(locale,tickLabelFormatString,(minValue - i)) : String.format(locale,tickLabelFormatString,maxValue - counter + minValue);
}
 else {
tickLabelString=Orientation.HORIZONTAL == orientation ? Helper.secondsToHHMMString(Helper.toSeconds(Helper.toRealValue(minValue - i),Helper.getZoneOffset())) : String.format(locale,tickLabelFormatString,maxValue - counter + minValue);
}
}
 else if (AxisType.TEXT == axisType) {
if (tickLabelCounter < noOfCategories) {
tickLabelString=categories.get(tickLabelCounter);
}
 else {
tickLabelString="String_Node_Str";
}
if (isAutoScale) {
tickLabelCounter+=(int)majorTickSpace;
}
 else {
tickLabelCounter++;
}
}
 else {
tickLabelString=dateTimeFormatter.format(toLocalDateTime((long)(minValue - i) * 1000));
}
drawTickLabel(isOnlyFirstAndLastTickLabelVisible,isZero,isMinValue,isMaxValue,fullRange,zeroColor,tickLabelColor,textPointX,textPointY,maxTextWidth,tickLabelString,orientation);
}
}
 else if (mediumTickMarksVisible && Double.compare(minorTickSpaceBD.setScale(12,BigDecimal.ROUND_HALF_UP).remainder(mediumCheck2).doubleValue(),0.0) != 0.0 && Double.compare(counterBD.setScale(12,BigDecimal.ROUND_HALF_UP).remainder(mediumCheck5).doubleValue(),0.0) == 0.0) {
drawTickMark(mediumTickMarkColor,mediumLineWidth,mediumPointX,mediumPointY,outerPointX,outerPointY);
}
 else if (minorTickMarksVisible && Double.compare(counterBD.setScale(12,BigDecimal.ROUND_HALF_UP).remainder(minorTickSpaceBD).doubleValue(),0.0) == 0) {
drawTickMark(minorTickMarkColor,minorLineWidth,minorPointX,minorPointY,outerPointX,outerPointY);
}
 else if (!isAutoScale && tickMarkCounter % 10 == 0) {
isMinValue=Double.compare(minValue,counter) == 0;
isMaxValue=Double.compare(maxValue,counter) == 0;
if (VERTICAL == orientation) {
isZero=Double.compare(0.0,maxValue - counter + minValue) == 0;
}
 else {
isZero=Double.compare(0.0,counter) == 0;
}
if (isZero) {
setZeroPosition(fixedPosition);
}
drawTickMark((fullRange && isZero) ? zeroColor : minorTickMarkColor,minorLineWidth,innerPointX,innerPointY,outerPointX,outerPointY);
if (tickLabelsVisible) {
String tickLabelString;
if (TickLabelFormat.NUMBER == getTickLabelFormat()) {
tickLabelString=Orientation.HORIZONTAL == orientation ? String.format(locale,tickLabelFormatString,(minValue - i)) : String.format(locale,tickLabelFormatString,maxValue - counter + minValue);
}
 else {
tickLabelString=Orientation.HORIZONTAL == orientation ? Helper.secondsToHHMMString(Helper.toSeconds(Helper.toRealValue(minValue - i),Helper.getZoneOffset())) : String.format(locale,tickLabelFormatString,maxValue - counter + minValue);
}
drawTickLabel(isOnlyFirstAndLastTickLabelVisible,isZero,isMinValue,isMaxValue,fullRange,zeroColor,tickLabelColor,textPointX,textPointY,maxTextWidth,tickLabelString,orientation);
}
}
 else if (tickMarkCounter % 1 == 0) {
drawTickMark(minorTickMarkColor,minorLineWidth,minorPointX,minorPointY,outerPointX,outerPointY);
}
counterBD=counterBD.add(minorTickSpaceBD);
counter=counterBD.doubleValue();
if (counter > maxValue) break;
}
}
 else if (AxisType.LOGARITHMIC == axisType) {
tickLabelFormatString="String_Node_Str";
double logLowerBound=Math.log10(getMinValue());
double logUpperBound=Math.log10(getMaxValue());
double section;
if (VERTICAL == orientation) {
section=height / logUpperBound;
if (Position.LEFT == position) {
axisCtx.strokeLine(anchorXPlusOffset,minPosition,anchorXPlusOffset,maxPosition);
}
 else if (Position.RIGHT == position) {
axisCtx.strokeLine(anchorX,minPosition,anchorX,maxPosition);
}
}
 else {
section=width / logUpperBound;
if (Position.BOTTOM == position) {
axisCtx.strokeLine(minPosition,anchorY,maxPosition,anchorY);
}
 else if (Position.TOP == position) {
axisCtx.strokeLine(minPosition,anchorYPlusOffset,maxPosition,anchorYPlusOffset);
}
}
for (double i=0; i <= logUpperBound; i+=1) {
for (double j=1; j <= 9; j++) {
BigDecimal value=new BigDecimal(j * Math.pow(10,i));
double stepSize=i > 0 ? (Math.log10(value.doubleValue()) % i) : Math.log10(value.doubleValue());
double fixedPosition;
if (VERTICAL == orientation) {
isMinValue=Double.compare(i,logUpperBound) == 0;
isMaxValue=i == 0;
fixedPosition=maxPosition - i * section - (stepSize * section);
if (Position.LEFT == position) {
innerPointX=anchorXPlusOffset - maxMajorTickMarkLength;
innerPointY=fixedPosition;
minorPointX=anchorXPlusOffset - maxMinorTickMarkLength;
minorPointY=fixedPosition;
outerPointX=anchorXPlusOffset;
outerPointY=fixedPosition;
textPointX=anchorXPlusOffset - textPosition;
textPointY=fixedPosition;
maxTextWidth=0.6 * width;
}
 else {
innerPointX=anchorX + maxMajorTickMarkLength;
innerPointY=fixedPosition;
minorPointX=anchorX + maxMinorTickMarkLength;
minorPointY=fixedPosition;
outerPointX=anchorX;
outerPointY=fixedPosition;
textPointX=anchorXPlusOffset;
textPointY=fixedPosition;
maxTextWidth=width;
}
}
 else {
isMinValue=i == 0;
isMaxValue=Double.compare(i,logUpperBound) == 0;
fixedPosition=i * section + (stepSize * section);
if (Position.BOTTOM == position) {
innerPointX=fixedPosition;
innerPointY=anchorY + maxMajorTickMarkLength;
minorPointX=fixedPosition;
minorPointY=anchorY + maxMinorTickMarkLength;
outerPointX=fixedPosition;
outerPointY=anchorY;
textPointX=fixedPosition;
textPointY=anchorY + textPosition - tickLabelFontSize * 0.2;
maxTextWidth=section;
}
 else {
innerPointX=fixedPosition;
innerPointY=anchorYPlusOffset - maxMajorTickMarkLength;
minorPointX=fixedPosition;
minorPointY=anchorYPlusOffset - maxMinorTickMarkLength;
outerPointX=fixedPosition;
outerPointY=anchorYPlusOffset;
textPointX=fixedPosition;
textPointY=anchorY - textPosition + tickLabelFontSize * 0.5;
maxTextWidth=section;
}
}
if (Helper.isPowerOf10(value.intValue())) {
if (majorTickMarksVisible) {
drawTickMark(majorTickMarkColor,majorLineWidth,innerPointX,innerPointY,outerPointX,outerPointY);
}
 else if (minorTickMarksVisible) {
drawTickMark(minorTickMarkColor,minorLineWidth,minorPointX,minorPointY,outerPointX,outerPointY);
}
if (tickLabelsVisible) {
axisCtx.setFill(tickLabelColor);
if (VERTICAL == orientation) {
axisCtx.setTextAlign(TextAlignment.RIGHT);
}
drawTickLabel(isOnlyFirstAndLastTickLabelVisible,false,isMinValue,isMaxValue,false,zeroColor,tickLabelColor,textPointX,textPointY,maxTextWidth,String.format(locale,tickLabelFormatString,value),orientation);
}
}
 else {
if (minorTickMarksVisible) {
drawTickMark(minorTickMarkColor,minorLineWidth,minorPointX,minorPointY,outerPointX,outerPointY);
}
}
}
}
}
drawAxisTitle(orientation,position);
}