KickJava   Java API By Example, From Geeks To Geeks.

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


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  * First.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: First.java,v 1.4 2003/11/11 15:11:32 mungady Exp $
31  *
32  * Changes
33  * -------
34  * 16-Jan-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 org.jfree.chart.ChartFactory;
42 import org.jfree.chart.ChartFrame;
43 import org.jfree.chart.JFreeChart;
44 import org.jfree.data.DefaultPieDataset;
45
46 /**
47  * A simple introduction to using JFreeChart. This demo is described in the
48  * JFreeChart Developer Guide, available to purchasers of commercial support
49  * packages for JFreeChart.
50  *
51  * @author David Gilbert
52  */

53 public class First {
54
55     /**
56      * The starting point for the demo.
57      *
58      * @param args ignored.
59      */

60     public static void main(String JavaDoc[] args) {
61
62         // create a dataset...
63
DefaultPieDataset data = new DefaultPieDataset();
64         data.setValue("Category 1", 43.2);
65         data.setValue("Category 2", 27.9);
66         data.setValue("Category 3", 79.5);
67
68         // create a chart...
69
JFreeChart chart = ChartFactory.createPieChart(
70             "Sample Pie Chart",
71             data,
72             true, // legend?
73
true, // tooltips?
74
false // URLs?
75
);
76
77         // create and display a frame...
78
ChartFrame frame = new ChartFrame("First", chart);
79         frame.pack();
80         frame.setVisible(true);
81
82     }
83
84 }
85
Popular Tags