diff options
author | Keith Packard <keithp@keithp.com> | 2011-10-08 11:46:38 -0600 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2011-10-08 11:46:38 -0600 |
commit | cbf5a649c8b7101bef9d57e48e42ac775e758c79 (patch) | |
tree | 9ec33b829609c4d7fd75142fc35bff48bafd0b16 /altosui/AltosGraphTime.java | |
parent | f9b0b7423c0640f729d61a91de6ff96ffe4b486e (diff) |
altosui: Allow for multiple instances of each state in the graph
With the new boost re-detect code, we can get multiple instances of
boost/fast/coast, so make sure each are displayed in the graph.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosui/AltosGraphTime.java')
-rw-r--r-- | altosui/AltosGraphTime.java | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/altosui/AltosGraphTime.java b/altosui/AltosGraphTime.java index ada6ef13..6a084b2c 100644 --- a/altosui/AltosGraphTime.java +++ b/altosui/AltosGraphTime.java @@ -4,6 +4,11 @@ package altosui; +import java.lang.*; +import java.io.*; +import java.util.concurrent.*; +import java.util.*; +import java.text.*; import java.awt.Color; import java.util.ArrayList; import java.util.HashMap; @@ -98,9 +103,10 @@ class AltosGraphTime extends AltosGraph { } static class StateMarker implements Element { - private double val = Double.NaN; + private LinkedList<Double> times = new LinkedList<Double>(); private String name; private int state; + private int prev_state = Altos.ao_flight_startup; StateMarker(int state, String name) { this.state = state; @@ -109,22 +115,19 @@ class AltosGraphTime extends AltosGraph { public void attachGraph(AltosGraphTime g) { return; } public void gotTimeData(double time, AltosDataPoint d) { - if (Double.isNaN(val) || time < val) { - if (d.state() == state) { - val = time; - } - } + if (prev_state != state && d.state() == state) + times.add(time); + prev_state = d.state(); } public void addToPlot(AltosGraphTime g, XYPlot plot) { - if (Double.isNaN(val)) - return; - - ValueMarker m = new ValueMarker(val); - m.setLabel(name); - m.setLabelAnchor(RectangleAnchor.TOP_RIGHT); - m.setLabelTextAnchor(TextAnchor.TOP_LEFT); - plot.addDomainMarker(m); + for (double time : times) { + ValueMarker m = new ValueMarker(time); + m.setLabel(name); + m.setLabelAnchor(RectangleAnchor.TOP_RIGHT); + m.setLabelTextAnchor(TextAnchor.TOP_LEFT); + plot.addDomainMarker(m); + } } } |