@Test public void generateReferenceValues8() { assertThat(LogValueScale.generateReferenceValues(Ranges.range(1, 10000), 2), equalTo((ListDouble) new ArrayDouble(1, 5, 10, 50, 100, 500, 1000, 5000, 10000))); }
static ListDouble generateReferenceValues(Range range, int subdivisionFactor) { CircularBufferDouble values = new CircularBufferDouble(100000); double minValue = range.getMinimum(); double maxValue = range.getMaximum(); int minExp = MathUtil.orderOf(minValue); int maxExp = MathUtil.orderOf(maxValue); int currentExp = minExp; while (currentExp <= maxExp) { double currentOrder = Math.pow(10, currentExp); if (currentOrder <= maxValue && currentOrder >= minValue) { values.addDouble(currentOrder); } for (int i = 0; i < subdivisionFactor; i++) { double newValue = (currentOrder * 10 * i) / subdivisionFactor; if ((newValue <= maxValue) && (newValue > currentOrder) && (newValue > minValue)) { values.addDouble(newValue); } } currentExp++; } return values; }
LogValueScale implements ValueScale { static ListDouble generateReferenceValues(Range range, int subdivisionFactor) { CircularBufferDouble values = new CircularBufferDouble(100000); double minValue = range.getMinimum(); double maxValue = range.getMaximum(); int minExp = MathUtil.orderOf(minValue); int maxExp = MathUtil.orderOf(maxValue); int currentExp = minExp; while (currentExp <= maxExp) { double currentOrder = Math.pow(10, currentExp); if (currentOrder <= maxValue && currentOrder >= minValue) { values.addDouble(currentOrder); } for (int i = 0; i < subdivisionFactor; i++) { double newValue = (currentOrder * 10 * i) / subdivisionFactor; if ((newValue <= maxValue) && (newValue > currentOrder) && (newValue > minValue)) { values.addDouble(newValue); } } currentExp++; } return values; } }
LogValueScale implements ValueScale { static ListDouble generateReferenceValues(Range range, int subdivisionFactor) { CircularBufferDouble values = new CircularBufferDouble(100000); double minValue = range.getMinimum(); double maxValue = range.getMaximum(); int minExp = MathUtil.orderOf(minValue); int maxExp = MathUtil.orderOf(maxValue); int currentExp = minExp; while (currentExp <= maxExp) { double currentOrder = Math.pow(10, currentExp); if (currentOrder <= maxValue && currentOrder >= minValue) { values.addDouble(currentOrder); } for (int i = 0; i < subdivisionFactor; i++) { double newValue = (currentOrder * 10 * i) / subdivisionFactor; if ((newValue <= maxValue) && (newValue > currentOrder) && (newValue > minValue)) { values.addDouble(newValue); } } currentExp++; } return values; }  }
LogValueScale implements ValueScale { static ListDouble generateReferenceValues(Range range, int subdivisionFactor) { CircularBufferDouble values = new CircularBufferDouble(100000); double minValue = range.getMinimum(); double maxValue = range.getMaximum(); int minExp = MathUtil.orderOf(minValue); int maxExp = MathUtil.orderOf(maxValue); int currentExp = minExp; while (currentExp <= maxExp) { double currentOrder = Math.pow(10, currentExp); if (currentOrder <= maxValue && currentOrder >= minValue) { values.addDouble(currentOrder); } for (int i = 0; i < subdivisionFactor; i++) { double newValue = (currentOrder * 10 * i) / subdivisionFactor; if ((newValue <= maxValue) && (newValue > currentOrder) && (newValue > minValue)) { values.addDouble(newValue); } } currentExp++; } return values; }  @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 { static ListDouble generateReferenceValues(Range range, int subdivisionFactor) { CircularBufferDouble values = new CircularBufferDouble(100000); double minValue = range.getMinimum(); double maxValue = range.getMaximum(); int minExp = MathUtil.orderOf(minValue); int maxExp = MathUtil.orderOf(maxValue); int currentExp = minExp; while (currentExp <= maxExp) { double currentOrder = Math.pow(10, currentExp); if (currentOrder <= maxValue && currentOrder >= minValue) { values.addDouble(currentOrder); } for (int i = 0; i < subdivisionFactor; i++) { double newValue = (currentOrder * 10 * i) / subdivisionFactor; if ((newValue <= maxValue) && (newValue > currentOrder) && (newValue > minValue)) { values.addDouble(newValue); } } currentExp++; } return values; }  @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);  }