From f558cfa1df77c36a459168c1953d0945ee5a7f9f Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 30 Mar 2011 11:48:03 -0700 Subject: altosui: Only plot acceleration when present in data file Eliminates a bogus axis and data line for devices which do not have an accelerometer. Signed-off-by: Keith Packard --- altosui/AltosGraphUI.java | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'altosui/AltosGraphUI.java') diff --git a/altosui/AltosGraphUI.java b/altosui/AltosGraphUI.java index cd158651..e98c302b 100644 --- a/altosui/AltosGraphUI.java +++ b/altosui/AltosGraphUI.java @@ -96,10 +96,14 @@ public class AltosGraphUI extends JFrame public ArrayList graphs() { ArrayList graphs = new ArrayList(); - graphs.add( myAltosGraphTime("Summary") - .addElement(height) - .addElement(speed) - .addElement(acceleration) ); + graphs.add( myAltosGraphTime("Summary") + .addElement(height) + .addElement(speed) + .addElement(acceleration) ); + + graphs.add( myAltosGraphTime("Summary") + .addElement(height) + .addElement(speed)); graphs.add( myAltosGraphTime("Altitude") .addElement(height) ); @@ -107,15 +111,15 @@ public class AltosGraphUI extends JFrame graphs.add( myAltosGraphTime("Speed") .addElement(speed) ); - graphs.add( myAltosGraphTime("Acceleration") - .addElement(acceleration) ); + graphs.add( myAltosGraphTime("Acceleration") + .addElement(acceleration) ); graphs.add( myAltosGraphTime("Temperature") .addElement(temperature) ); - graphs.add( myAltosGraphTime("Continuity") - .addElement(drogue_voltage) - .addElement(main_voltage) ); + graphs.add( myAltosGraphTime("Continuity") + .addElement(drogue_voltage) + .addElement(main_voltage) ); return graphs; } @@ -154,20 +158,23 @@ public class AltosGraphUI extends JFrame public AltosGraphUI(AltosRecordIterable records) { super("Altos Graph"); - Iterable reader = new AltosDataPointReader (records); + AltosDataPointReader reader = new AltosDataPointReader (records); if (reader == null) return; - init(reader, 0); + if (reader.has_accel) + init(reader, 0); + else + init(reader, 1); } - public AltosGraphUI(Iterable data, int which) + public AltosGraphUI(AltosDataPointReader data, int which) { super("Altos Graph"); init(data, which); } - private void init(Iterable data, int which) { + private void init(AltosDataPointReader data, int which) { AltosGraph graph = createGraph(data, which); JFreeChart chart = graph.createChart(); -- cgit v1.2.3