KickJava   Java API By Example, From Geeks To Geeks.

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


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  * TimeSeriesDemo7.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: TimeSeriesDemo7.java,v 1.5 2003/11/28 10:57:34 mungady Exp $
31  *
32  * Changes
33  * -------
34  * 05-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.XYDataset;
44 import org.jfree.data.time.TimeSeriesCollection;
45 import org.jfree.ui.ApplicationFrame;
46 import org.jfree.ui.RefineryUtilities;
47
48 /**
49  * A time series chart.
50  *
51  * @author David Gilbert
52  */

53 public class TimeSeriesDemo7 extends ApplicationFrame {
54
55     /**
56      * A demonstration application showing how to create a simple time series chart.
57      *
58      * @param title the frame title.
59      */

60     public TimeSeriesDemo7(String JavaDoc title) {
61
62         super(title);
63
64         // create a title...
65
String JavaDoc chartTitle = "Time Series Demo";
66         XYDataset dataset = new TimeSeriesCollection(DemoDatasetFactory.createEURTimeSeries());
67
68         JFreeChart chart = ChartFactory.createTimeSeriesChart(
69             chartTitle,
70             "Date",
71             "Value",
72             dataset,
73             true,
74             true,
75             false
76         );
77
78         ChartPanel chartPanel = new ChartPanel(chart);
79         chartPanel.setPreferredSize(new java.awt.Dimension JavaDoc(500, 270));
80         setContentPane(chartPanel);
81
82     }
83
84     // ****************************************************************************
85
// * COMMERCIAL SUPPORT / JFREECHART DEVELOPER GUIDE *
86
// * Please note that commercial support and documentation is available from: *
87
// * *
88
// * http://www.object-refinery.com/jfreechart/support.html *
89
// * *
90
// * This is not only a great service for developers, but is a VERY IMPORTANT *
91
// * source of funding for the JFreeChart project. Please support us so that *
92
// * we can continue developing free software. *
93
// ****************************************************************************
94

95     /**
96      * Starting point for the demonstration application.
97      *
98      * @param args ignored.
99      */

100     public static void main(String JavaDoc[] args) {
101
102         TimeSeriesDemo7 demo = new TimeSeriesDemo7("Time Series Demo 7");
103         demo.pack();
104         RefineryUtilities.centerFrameOnScreen(demo);
105         demo.setVisible(true);
106
107     }
108
109 }
110
Popular Tags