Skip to content

Instantly share code, notes, and snippets.

@kevinsdooapp
Created August 1, 2012 12:39
Show Gist options
  • Save kevinsdooapp/3226464 to your computer and use it in GitHub Desktop.
Save kevinsdooapp/3226464 to your computer and use it in GitHub Desktop.
calculateMinorTickMarks implementation for logarithmic axis
/**
* {@inheritDoc}
*/
@Override
protected List<Number> calculateMinorTickMarks() {
Number[] range = getRange();
List<Number> minorTickMarksPositions = new ArrayList<Number>();
if (range != null) {
Number upperBound = range[1];
double logUpperBound = Math.log10(upperBound.doubleValue());
int minorTickMarkCount = getMinorTickCount();
for (double i = 0; i <= logUpperBound; i += 1) {
for (double j = 0; j <= 9; j += (1. / minorTickMarkCount)) {
double value = j * Math.pow(10, i);
minorTickMarksPositions.add(value);
}
}
}
return minorTickMarksPositions;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment