projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altosuilib/micropeak: Add state markers to micropeak graph
[fw/altos]
/
altosuilib
/
AltosUIGraph.java
diff --git
a/altosuilib/AltosUIGraph.java
b/altosuilib/AltosUIGraph.java
index e79e36ba7d3bddb7e1c62c56ca1940500e68edd1..e212093ab64c516fa2a222a7cc0370b518d59cec 100644
(file)
--- a/
altosuilib/AltosUIGraph.java
+++ b/
altosuilib/AltosUIGraph.java
@@
-41,8
+41,9
@@
public class AltosUIGraph implements AltosUnitsListener {
public ChartPanel panel;
NumberAxis xAxis;
AltosUIEnable enable;
public ChartPanel panel;
NumberAxis xAxis;
AltosUIEnable enable;
- ArrayList<AltosUI
Series> serie
s;
+ ArrayList<AltosUI
Grapher> grapher
s;
AltosUIDataSet dataSet;
AltosUIDataSet dataSet;
+ int index;
static final private Color gridline_color = new Color(0, 0, 0);
static final private Color border_color = new Color(255, 255, 255);
static final private Color gridline_color = new Color(0, 0, 0);
static final private Color border_color = new Color(255, 255, 255);
@@
-52,7
+53,7
@@
public class AltosUIGraph implements AltosUnitsListener {
return panel;
}
return panel;
}
- public void addSeries(
int index,
String label, int fetch, AltosUnits units, Color color) {
+ public void addSeries(String label, int fetch, AltosUnits units, Color color) {
AltosUISeries series = new AltosUISeries(label, fetch, units, color);
XYSeriesCollection dataset = new XYSeriesCollection(series);
AltosUISeries series = new AltosUISeries(label, fetch, units, color);
XYSeriesCollection dataset = new XYSeriesCollection(series);
@@
-63,22
+64,30
@@
public class AltosUIGraph implements AltosUnitsListener {
plot.mapDatasetToRangeAxis(index, index);
if (enable != null)
enable.add(label, series, true);
plot.mapDatasetToRangeAxis(index, index);
if (enable != null)
enable.add(label, series, true);
- this.series.add(series);
+ this.graphers.add(series);
+ index++;
}
}
+ public void addMarker(String label, int fetch, Color color) {
+ AltosUIMarker marker = new AltosUIMarker(fetch, color, plot);
+ if (enable != null)
+ enable.add(label, marker, true);
+ this.graphers.add(marker);
+ }
+
public void resetData() {
public void resetData() {
- for (AltosUI
Series s : serie
s)
-
s
.clear();
+ for (AltosUI
Grapher g : grapher
s)
+
g
.clear();
if (dataSet != null) {
for (AltosUIDataPoint dataPoint : dataSet.dataPoints())
if (dataSet != null) {
for (AltosUIDataPoint dataPoint : dataSet.dataPoints())
- for (AltosUI
Series s : serie
s)
-
s
.add(dataPoint);
+ for (AltosUI
Grapher g : grapher
s)
+
g
.add(dataPoint);
}
}
public void units_changed(boolean imperial_units) {
}
}
public void units_changed(boolean imperial_units) {
- for (AltosUI
Series s : serie
s)
-
s
.set_units();
+ for (AltosUI
Grapher g : grapher
s)
+
g
.set_units();
resetData();
}
resetData();
}
@@
-96,7
+105,8
@@
public class AltosUIGraph implements AltosUnitsListener {
public AltosUIGraph(AltosUIEnable enable) {
this.enable = enable;
public AltosUIGraph(AltosUIEnable enable) {
this.enable = enable;
- this.series = new ArrayList<AltosUISeries>();
+ this.graphers = new ArrayList<AltosUIGrapher>();
+ this.index = 0;
xAxis = new NumberAxis("Time (s)");
xAxis = new NumberAxis("Time (s)");