1 24 package info.monitorenter.gui.chart.demos; 25 26 import info.monitorenter.gui.chart.AAxis; 27 import info.monitorenter.gui.chart.Chart2D; 28 import info.monitorenter.gui.chart.ITrace2D; 29 import info.monitorenter.gui.chart.axis.AxisLinear; 30 import info.monitorenter.gui.chart.labelformatters.LabelFormatterDate; 31 import info.monitorenter.gui.chart.traces.Trace2DSimple; 32 33 import java.awt.event.WindowAdapter ; 34 import java.awt.event.WindowEvent ; 35 import java.text.DateFormat ; 36 import java.text.ParseException ; 37 import java.text.SimpleDateFormat ; 38 39 import javax.swing.JFrame ; 40 41 42 49 public final class AdvancedStaticChart { 50 51 62 public static void main(final String [] args) throws ParseException { 63 Chart2D chart = new Chart2D(); 65 ITrace2D trace = new Trace2DSimple(); 67 AAxis yAxis = new AxisLinear(); 68 yAxis.setFormatter(new LabelFormatterDate(new SimpleDateFormat ())); 69 chart.setAxisY(yAxis); 70 double high = DateFormat.getInstance().parse("01.08.05 18:00").getTime(); 72 for (double i = 0; i < 200; i++) { 73 trace.addPoint(i, high); 74 high += 1000 * 50; 75 76 } 77 chart.addTrace(trace); 79 80 JFrame frame = new JFrame ("AdvancedStaticChart"); 83 frame.getContentPane().add(chart); 85 frame.setSize(600, 600); 86 frame.addWindowListener(new WindowAdapter () { 88 public void windowClosing(final WindowEvent e) { 89 System.exit(0); 90 } 91 }); 92 frame.setVisible(true); 93 } 94 95 99 private AdvancedStaticChart() { 100 super(); 101 } 102 } 103 | Popular Tags |