KickJava   Java API By Example, From Geeks To Geeks.

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


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-2002, 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  * JFreeChartAppletDemo.java
24  * -------------------------
25  * (C) Copyright 2002, 2003, by Object Refinery Limited.
26  *
27  * Original Author: David Gilbert (for Object Refinery Limited);
28  * Contributor(s): -;
29  *
30  * $Id: JFreeChartAppletDemo.java,v 1.7 2003/11/28 10:09:20 mungady Exp $
31  *
32  * Changes
33  * -------
34  * 11-Feb-2002 : Version 1 (DG);
35  * 10-Oct-2002 : Fixed errors reported by Checkstyle (DG);
36  *
37  */

38
39 package org.jfree.chart.demo;
40
41 import javax.swing.JApplet JavaDoc;
42 import javax.swing.JTabbedPane JavaDoc;
43
44 import org.jfree.chart.ChartFactory;
45 import org.jfree.chart.ChartPanel;
46 import org.jfree.chart.JFreeChart;
47 import org.jfree.chart.plot.PlotOrientation;
48 import org.jfree.data.CategoryDataset;
49 import org.jfree.data.XYDataset;
50
51 /**
52  * A simple applet containing two sample charts in a JTabbedPane.
53  *
54  * @author David Gilbert
55  */

56 public class JFreeChartAppletDemo extends JApplet JavaDoc {
57
58     /**
59      * Constructs the demo applet.
60      */

61     public JFreeChartAppletDemo() {
62
63         JTabbedPane JavaDoc tabs = new JTabbedPane JavaDoc();
64
65         XYDataset data1 = DemoDatasetFactory.createTimeSeriesCollection1();
66         JFreeChart chart1 = ChartFactory.createTimeSeriesChart(
67             "Time Series",
68             "Date",
69             "Rate",
70             data1,
71             true,
72             true,
73             false
74         );
75         ChartPanel panel1 = new ChartPanel(
76             chart1, 400, 300, 200, 100, 400, 200,
77             true, false, false, false, true, true
78         );
79         tabs.add("Chart 1", panel1);
80
81         CategoryDataset data2 = DemoDatasetFactory.createCategoryDataset();
82         JFreeChart chart2 = ChartFactory.createBarChart(
83             "Bar Chart",
84             "Categories",
85             "Value",
86             data2,
87             PlotOrientation.HORIZONTAL,
88             true,
89             true,
90             false
91         );
92         ChartPanel panel2 = new ChartPanel(
93             chart2, 400, 300, 200, 100, 400, 200,
94             true, false, false, false, true, true
95         );
96         tabs.add("Chart 2", panel2);
97
98         getContentPane().add(tabs);
99
100     }
101
102 }
103
Popular Tags