From: Bill Kuker Date: Sun, 24 Oct 2010 22:34:34 +0000 (+0000) Subject: minor fix to not show NULL X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=4be68b927596a90de669077c6843abd613ed0aae;p=sw%2Fmotorsim minor fix to not show NULL --- diff --git a/src/com/billkuker/rocketry/motorsim/visual/Chart.java b/src/com/billkuker/rocketry/motorsim/visual/Chart.java index 2020bdd..97eb6df 100644 --- a/src/com/billkuker/rocketry/motorsim/visual/Chart.java +++ b/src/com/billkuker/rocketry/motorsim/visual/Chart.java @@ -138,7 +138,10 @@ public class Chart extends JPanel { marker = new ValueMarker(m.doubleValue(xUnit)); marker.setPaint(Color.blue); marker.setAlpha(0.8f); - marker.setLabel(RocketScience.approx(getNear(m))); + + Amount val = getNear(m); + if ( val != null ) + marker.setLabel(RocketScience.approx(val)); marker.setLabelTextAnchor(TextAnchor.TOP_LEFT); marker.setLabelOffset(new RectangleInsets(0,-5,0,0)); @@ -181,7 +184,6 @@ public class Chart extends JPanel { final double higherY = s.getY(idxH).doubleValue(); final double y = lowerY + dist * (higherY - lowerY); - return Amount.valueOf( y, yUnit); } }