summaryrefslogtreecommitdiff
path: root/altosui/AltosGraphUI.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-03-30 11:48:03 -0700
committerKeith Packard <keithp@keithp.com>2011-03-30 11:48:03 -0700
commitf558cfa1df77c36a459168c1953d0945ee5a7f9f (patch)
tree4fbc53c7ab676252acde905c6d85518a9d341da7 /altosui/AltosGraphUI.java
parenta9df9fc257eb2d7038d66ac7c2539aae4474bf12 (diff)
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 <keithp@keithp.com>
Diffstat (limited to 'altosui/AltosGraphUI.java')
-rw-r--r--altosui/AltosGraphUI.java33
1 files changed, 20 insertions, 13 deletions
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<AltosGraph> graphs() {
ArrayList<AltosGraph> graphs = new ArrayList<AltosGraph>();
- 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<AltosDataPoint> 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<AltosDataPoint> data, int which)
+ public AltosGraphUI(AltosDataPointReader data, int which)
{
super("Altos Graph");
init(data, which);
}
- private void init(Iterable<AltosDataPoint> data, int which) {
+ private void init(AltosDataPointReader data, int which) {
AltosGraph graph = createGraph(data, which);
JFreeChart chart = graph.createChart();