1 37 38 package org.jfree.chart.demo; 39 40 import org.jfree.chart.ChartFactory; 41 import org.jfree.chart.ChartPanel; 42 import org.jfree.chart.JFreeChart; 43 import org.jfree.data.time.Hour; 44 import org.jfree.data.time.Minute; 45 import org.jfree.data.time.TimeSeries; 46 import org.jfree.data.time.TimeSeriesCollection; 47 import org.jfree.ui.ApplicationFrame; 48 import org.jfree.ui.RefineryUtilities; 49 50 55 public class TimeSeriesDemo10 extends ApplicationFrame { 56 57 62 public TimeSeriesDemo10(String title) { 63 64 super(title); 65 66 TimeSeries series = new TimeSeries("Per Minute Data", Minute.class); 67 Hour hour = new Hour(); 68 series.add(new Minute(1, hour), 10.2); 69 series.add(new Minute(3, hour), 17.3); 70 series.add(new Minute(9, hour), 14.6); 71 series.add(new Minute(11, hour), 11.9); 72 series.add(new Minute(15, hour), 13.5); 73 series.add(new Minute(19, hour), 10.9); 74 TimeSeriesCollection dataset = new TimeSeriesCollection(series); 75 JFreeChart chart = ChartFactory.createTimeSeriesChart( 76 "Time Series Demo 10", 77 "Time", 78 "Value", 79 dataset, 80 true, 81 true, 82 false 83 ); 84 ChartPanel chartPanel = new ChartPanel(chart); 85 chartPanel.setPreferredSize(new java.awt.Dimension (500, 270)); 86 setContentPane(chartPanel); 87 88 } 89 90 101 106 public static void main(String [] args) { 107 108 TimeSeriesDemo10 demo = new TimeSeriesDemo10("Time Series Demo 10"); 109 demo.pack(); 110 RefineryUtilities.centerFrameOnScreen(demo); 111 demo.setVisible(true); 112 113 } 114 115 } 116 | Popular Tags |