summaryrefslogtreecommitdiff
path: root/micropeak/MicroGraph.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2013-01-02 16:19:33 -0800
committerKeith Packard <keithp@keithp.com>2013-01-02 16:19:33 -0800
commit9e4c5b0a6ed3594cff6ab71398c172daa7c67177 (patch)
treef4785fc50b6cd4484a74ae42e9935b41815e58d0 /micropeak/MicroGraph.java
parent1979063928f1cdfc75c01ec098164c2822a5138d (diff)
micropeak: Use JTextArea instead of TextArea
Looks nicer and doesn't appear to have the same weird clipping problem Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'micropeak/MicroGraph.java')
-rw-r--r--micropeak/MicroGraph.java23
1 files changed, 12 insertions, 11 deletions
diff --git a/micropeak/MicroGraph.java b/micropeak/MicroGraph.java
index 8330a67b..d2e86f9f 100644
--- a/micropeak/MicroGraph.java
+++ b/micropeak/MicroGraph.java
@@ -106,10 +106,12 @@ public class MicroGraph implements AltosUnitsListener {
heightSeries.clear();
speedSeries.clear();
accelSeries.clear();
- for (MicroDataPoint point : data.points()) {
- heightSeries.add(point.time, AltosConvert.height.value(point.height));
- speedSeries.add(point.time, AltosConvert.speed.value(point.speed));
- accelSeries.add(point.time, AltosConvert.accel.value(point.accel));
+ if (data != null) {
+ for (MicroDataPoint point : data.points()) {
+ heightSeries.add(point.time, AltosConvert.height.value(point.height));
+ speedSeries.add(point.time, AltosConvert.speed.value(point.speed));
+ accelSeries.add(point.time, AltosConvert.accel.value(point.accel));
+ }
}
}
@@ -119,17 +121,16 @@ public class MicroGraph implements AltosUnitsListener {
public void setData (MicroData data) {
this.data = data;
- chart.setTitle(data.name);
+ if (data != null)
+ setName(data.name);
resetData();
}
public void units_changed(boolean imperial_units) {
- if (data != null) {
- heightSeries.set_units(AltosConvert.height.show_units());
- speedSeries.set_units(AltosConvert.speed.show_units());
- accelSeries.set_units(AltosConvert.accel.show_units());
- resetData();
- }
+ heightSeries.set_units(AltosConvert.height.show_units());
+ speedSeries.set_units(AltosConvert.speed.show_units());
+ accelSeries.set_units(AltosConvert.accel.show_units());
+ resetData();
}
public MicroGraph() {