diff options
| author | Anthony Towns <aj@erisian.com.au> | 2010-09-15 06:51:05 +1000 |
|---|---|---|
| committer | Anthony Towns <aj@erisian.com.au> | 2010-09-15 06:51:05 +1000 |
| commit | 61590b8729831cb138b2ba6b88802c208d114753 (patch) | |
| tree | 38bf7eaa2ab16a7f7bb69f400fe7142d3d033716 /ao-tools/altosui/AltosGraph.java | |
| parent | 3d64f5a6511529ca53699190f4d54de1ba62a9bd (diff) | |
Add graphing.
Diffstat (limited to 'ao-tools/altosui/AltosGraph.java')
| -rw-r--r-- | ao-tools/altosui/AltosGraph.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/ao-tools/altosui/AltosGraph.java b/ao-tools/altosui/AltosGraph.java new file mode 100644 index 00000000..fa3b87c1 --- /dev/null +++ b/ao-tools/altosui/AltosGraph.java @@ -0,0 +1,27 @@ + +// Copyright (c) 2010 Anthony Towns +// GPL v2 or later + +package altosui; + +import java.io.*; + +import org.jfree.chart.JFreeChart; +import org.jfree.chart.ChartUtilities; + +import altosui.AltosDataPoint; + +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); + } +} |
