Created
August 1, 2012 12:39
-
-
Save kevinsdooapp/3226464 to your computer and use it in GitHub Desktop.
calculateMinorTickMarks implementation for logarithmic axis
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* {@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