diff --git a/src/chart/Chart.java b/src/chart/Chart.java index a479802..d5556d0 100644 --- a/src/chart/Chart.java +++ b/src/chart/Chart.java @@ -263,8 +263,10 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab // ys = c_rect.height / c_mm.getDiff(); - return (c_rect.height - (((float)Math.log(y) - c_mm.getMin()) * ys)) + c_rect.y; - + // return (c_rect.height - (((float)Math.log(y) - c_mm.getMin()) * ys)) + c_rect.y; + return c_rect.height + c_rect.y - ((float)Math.log(y) - c_mm.getMin()) * ys; + + /* float m = c_mm.getMax() / c_mm.getMin(); float fac = (float) c_rect.height / (float) Math.log(m); @@ -293,9 +295,21 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab // -(y-c_rect.y-c_rect.heigh) = (val - c_mm.getMin()) * c_yscaling // (-(y-c_rect.y-c_rect.heigh))/c_yscaling = (val - c_mm.getMin()) - - if (logs){ - return (-(Math.exp(y)-c_rect.y-c_rect.height))/c_yscaling+Math.exp(c_mm.getMin()); + + if (c_mm.isLog()){ + float ys = c_rect.height / c_mm.getDiff(); + + + //val = return c_rect.height + c_rect.y - ((float)Math.log(y) - c_mm.getMin()) * ys; + // ((float)Math.log(y) - c_mm.getMin()) * ys = c_rect.height + c_rect.y + // ((float)Math.log(y) - c_mm.getMin()) = (c_rect.height + c_rect.y)/ys + // ((float)Math.log(y) = (c_rect.height + c_rect.y)/ys + c_mm.getMin()) + + //return (-(Math.exp(y)-c_rect.y-c_rect.height))/ys+c_mm.getMin(); + + + return Math.exp( (c_rect.height + c_rect.y)/ys + c_mm.getMin() ); + } @@ -413,7 +427,7 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab for (int yp=(int) y2; yp