KickJava   Java API By Example, From Geeks To Geeks.

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


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  * HighLowChartDemo.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: HighLowChartDemo.java,v 1.4 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.chart.axis.DateAxis;
44 import org.jfree.chart.axis.DateTickMarkPosition;
45 import org.jfree.data.HighLowDataset;
46 import org.jfree.ui.ApplicationFrame;
47 import org.jfree.ui.RefineryUtilities;
48
49 /**
50  * A demo showing a high-low-open-close chart.
51  *
52  * @author David Gilbert
53  */

54 public class HighLowChartDemo extends ApplicationFrame {
55
56     /**
57      * A demonstration application showing a high-low-open-close chart.
58      *
59      * @param title the frame title.
60      */

61     public HighLowChartDemo(String JavaDoc title) {
62
63         super(title);
64
65         HighLowDataset dataset = DemoDatasetFactory.createHighLowDataset();
66         JFreeChart chart = ChartFactory.createHighLowChart("High-Low-Open-Close Demo",
67                                                            "Time", "Value",
68                                                            dataset, true);
69         DateAxis axis = (DateAxis) chart.getXYPlot().getDomainAxis();
70         axis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);
71         ChartPanel chartPanel = new ChartPanel(chart);
72         chartPanel.setPreferredSize(new java.awt.Dimension JavaDoc(500, 270));
73         setContentPane(chartPanel);
74
75     }
76
77     // ****************************************************************************
78
// * COMMERCIAL SUPPORT / JFREECHART DEVELOPER GUIDE *
79
// * Please note that commercial support and documentation is available from: *
80
// * *
81
// * http://www.object-refinery.com/jfreechart/support.html *
82
// * *
83
// * This is not only a great service for developers, but is a VERY IMPORTANT *
84
// * source of funding for the JFreeChart project. Please support us so that *
85
// * we can continue developing free software. *
86
// ****************************************************************************
87

88     /**
89      * Starting point for the demonstration application.
90      *
91      * @param args ignored.
92      */

93     public static void main(String JavaDoc[] args) {
94
95         HighLowChartDemo demo = new HighLowChartDemo("High-Low-Open-Close Demo");
96         demo.pack();
97         RefineryUtilities.centerFrameOnScreen(demo);
98         demo.setVisible(true);
99
100     }
101
102 }
103
Popular Tags