Created
August 1, 2012 13:02
-
-
Save kevinsdooapp/3226659 to your computer and use it in GitHub Desktop.
data and displayPosition matching
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
@Override | |
public Number getValueForDisplay(double displayPosition) { | |
double delta = logUpperBound.get() - logLowerBound.get(); | |
if (getSide().isVertical()) { | |
return Math.pow(10, (((displayPosition - getHeight()) / -getHeight()) * delta) + logLowerBound.get()); | |
} else { | |
return Math.pow(10, (((displayPosition / getWidth()) * delta) + logLowerBound.get())); | |
} | |
} | |
@Override | |
public double getDisplayPosition(Number value) { | |
double delta = logUpperBound.get() - logLowerBound.get(); | |
double deltaV = Math.log10(value.doubleValue()) - logLowerBound.get(); | |
if (getSide().isVertical()) { | |
return (1. - ((deltaV) / delta)) * getHeight(); | |
} else { | |
return ((deltaV) / delta) * getWidth(); | |
} | |
} | |
@Override | |
protected Object autoRange(double minValue, double maxValue, double length, double labelSize) { | |
Double[] range = new Double[] { minValue, maxValue }; | |
return range; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment