summaryrefslogtreecommitdiff
path: root/altosui/AltosGraph.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2010-11-24 15:10:36 -0800
committerKeith Packard <keithp@keithp.com>2010-11-24 15:10:36 -0800
commit28d621c5885953afe3b7435e582b80b75314506e (patch)
treeb5d6da55ce3e790a83352dd1433f88b4696e4171 /altosui/AltosGraph.java
parent6d0098e497ee2d9a1d1113bf3fb907dd48bdcf80 (diff)
parent3fbefb3eea981d34a09496cf8abf0119de2e35bf (diff)
Merge branch 'buttonbox' into telemetrum-v1.1telemetrum-v1.1
Diffstat (limited to 'altosui/AltosGraph.java')
-rw-r--r--altosui/AltosGraph.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/altosui/AltosGraph.java b/altosui/AltosGraph.java
new file mode 100644
index 00000000..58c27979
--- /dev/null
+++ b/altosui/AltosGraph.java
@@ -0,0 +1,25 @@
+
+// Copyright (c) 2010 Anthony Towns
+// GPL v2 or later
+
+package altosui;
+
+import java.io.*;
+
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.ChartUtilities;
+
+abstract class AltosGraph {
+ public String filename;
+ public abstract void addData(AltosDataPoint d);
+ public abstract JFreeChart createChart();
+ public void toPNG() throws java.io.IOException { toPNG(300, 500); }
+ public void toPNG(int width, int height)
+ throws java.io.IOException
+ {
+ File pngout = new File(filename);
+ JFreeChart chart = createChart();
+ ChartUtilities.saveChartAsPNG(pngout, chart, width, height);
+ System.out.println("Created " + filename);
+ }
+}