@Test public void scaleValue1() { ValueScale logScale = ValueScales.logScale(); assertThat(logScale.scaleValue(10, 1, 100, 0, 100), equalTo(50.0)); }
@Override public double scaleValue(double value, double minValue, double maxValue, double newMinValue, double newMaxValue) { value = Math.log10(value); minValue = Math.log10(minValue); maxValue = Math.log10(maxValue); double oldRange = maxValue - minValue; double newRange = newMaxValue - newMinValue; return newMinValue + (value - minValue) / oldRange * newRange; }
LogValueScale implements ValueScale { @Override public double scaleValue(double value, double minValue, double maxValue, double newMinValue, double newMaxValue) { value = Math.log10(value); minValue = Math.log10(minValue); maxValue = Math.log10(maxValue); double oldRange = maxValue - minValue; double newRange = newMaxValue - newMinValue; return newMinValue + (value - minValue) / oldRange * newRange; } }
LogValueScale implements ValueScale { @Override public double scaleValue(double value, double minValue, double maxValue, double newMinValue, double newMaxValue) { value = Math.log10(value); minValue = Math.log10(minValue); maxValue = Math.log10(maxValue); double oldRange = maxValue - minValue; double newRange = newMaxValue - newMinValue; return newMinValue + (value - minValue) / oldRange * newRange; }  }
LogValueScale implements ValueScale { @Override public double scaleValue(double value, double minValue, double maxValue, double newMinValue, double newMaxValue) { value = Math.log10(value); minValue = Math.log10(minValue); maxValue = Math.log10(maxValue); double oldRange = maxValue - minValue; double newRange = newMaxValue - newMinValue; return newMinValue + (value - minValue) / oldRange * newRange; }  @Override double scaleValue(double value, double minValue, double maxValue, double newMinValue, double newMaxValue); @Override double invScaleValue(double scaleValue, double actualMinValue, double actualMaxValue, double scaleMinValue, double scaleMaxValue); @Override ValueAxis references(Range range, int minRefs, int maxRefs); }
LogValueScale implements ValueScale { @Override public double scaleValue(double value, double minValue, double maxValue, double newMinValue, double newMaxValue) { value = Math.log10(value); minValue = Math.log10(minValue); maxValue = Math.log10(maxValue); double oldRange = maxValue - minValue; double newRange = newMaxValue - newMinValue; return newMinValue + (value - minValue) / oldRange * newRange; }  @Override double scaleValue(double value, double minValue, double maxValue, double newMinValue, double newMaxValue); @Override double invScaleValue(double scaleValue, double actualMinValue, double actualMaxValue, double scaleMinValue, double scaleMaxValue); @Override ValueAxis references(Range range, int minRefs, int maxRefs);  }