altos: Shrink ao_cmd_put16, ao_cmd_hex and ao_cmd
[fw/altos] / altosui / AltosGraph.java
1
2 // Copyright (c) 2010 Anthony Towns
3 // GPL v2 or later
4
5 package altosui;
6
7 import java.io.*;
8
9 import org.jfree.chart.JFreeChart;
10 import org.jfree.chart.ChartUtilities;
11
12 abstract class AltosGraph {
13     public String filename;
14     public abstract void addData(AltosDataPoint d);
15     public abstract JFreeChart createChart();
16     public void toPNG() throws java.io.IOException { toPNG(300, 500); }
17     public void toPNG(int width, int height)
18         throws java.io.IOException
19     {
20         File pngout = new File(filename);
21         JFreeChart chart = createChart();
22         ChartUtilities.saveChartAsPNG(pngout, chart, width, height);
23         System.out.println("Created " + filename);
24     }
25 }