1 24 package info.monitorenter.gui.chart.axis; 25 26 import info.monitorenter.gui.chart.ITrace2D; 27 import info.monitorenter.gui.chart.labelformatters.LabelFormatterSimple; 28 29 import java.util.Iterator ; 30 31 51 public class AxisLog10 extends AAxisTransformation { 52 53 59 public AxisLog10() { 60 super(new LabelFormatterSimple()); 61 } 62 63 81 protected double transform(final double in) { 82 83 double toTransform = in; 84 if (toTransform < 1) { 90 Iterator itTraces = this.m_accessor.getChart().getTraces().iterator(); 93 if (!itTraces.hasNext()) { 94 toTransform = 1.0; 95 } else { 96 ITrace2D trace; 97 while (itTraces.hasNext()) { 98 trace = (ITrace2D) itTraces.next(); 99 if (trace.iterator().hasNext()) { 100 throw new IllegalArgumentException (this.getClass().getName() 102 + " must not be used with values < 1!"); 103 } 104 } 105 toTransform = 1.0; 107 } 108 } 109 double result = Math.log(toTransform) / Math.log(10); 111 if (result == Double.POSITIVE_INFINITY) { 112 result = Double.MAX_VALUE; 113 } 114 return result; 115 } 116 117 120 protected double untransform(final double in) { 121 return Math.pow(10, in); 122 } 123 124 } 125 | Popular Tags |