KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfree > chart > demo > TimeSeriesDemo10


1 /* ======================================
2  * JFreeChart : a free Java chart library
3  * ======================================
4  *
5  * Project Info: http://www.jfree.org/jfreechart/index.html
6  * Project Lead: David Gilbert (david.gilbert@object-refinery.com);
7  *
8  * (C) Copyright 2000-2003, by Object Refinery Limited and Contributors.
9  *
10  * This library is free software; you can redistribute it and/or modify it under the terms
11  * of the GNU Lesser General Public License as published by the Free Software Foundation;
12  * either version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
15  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License along with this
19  * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
20  * Boston, MA 02111-1307, USA.
21  *
22  * ---------------------
23  * TimeSeriesDemo10.java
24  * ---------------------
25  * (C) Copyright 2003 by Object Refinery Limited and Contributors.
26  *
27  * Original Author: David Gilbert (for Object Refinery Limited);
28  * Contributor(s): -;
29  *
30  * $Id: TimeSeriesDemo10.java,v 1.4 2003/11/28 10:57:36 mungady Exp $
31  *
32  * Changes
33  * -------
34  * 21-Feb-2003 : Version 1 (DG);
35  *
36  */

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 /**
51  * A demo showing....
52  *
53  * @author David Gilbert
54  */

55 public class TimeSeriesDemo10 extends ApplicationFrame {
56
57     /**
58      * A demonstration application.
59      *
60      * @param title the frame title.
61      */

62     public TimeSeriesDemo10(String JavaDoc 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 JavaDoc(500, 270));
86         setContentPane(chartPanel);
87
88     }
89
90     // ****************************************************************************
91
// * COMMERCIAL SUPPORT / JFREECHART DEVELOPER GUIDE *
92
// * Please note that commercial support and documentation is available from: *
93
// * *
94
// * http://www.object-refinery.com/jfreechart/support.html *
95
// * *
96
// * This is not only a great service for developers, but is a VERY IMPORTANT *
97
// * source of funding for the JFreeChart project. Please support us so that *
98
// * we can continue developing free software. *
99
// ****************************************************************************
100

101     /**
102      * Starting point for the demonstration application.
103      *
104      * @param args ignored.
105      */

106     public static void main(String JavaDoc[] 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