KickJava   Java API By Example, From Geeks To Geeks.

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


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  * ScatterPlotDemo3.java
24  * ---------------------
25  * (C) Copyright 2002, 2003, by Object Refinery Limited and Contributors.
26  *
27  * Original Author: David Gilbert (for Object Refinery Limited);
28  * Contributor(s): -;
29  *
30  * $Id: ScatterPlotDemo3.java,v 1.5 2003/11/28 10:57:35 mungady Exp $
31  *
32  * Changes
33  * -------
34  * 03-Sep-2002 : Version 1 (DG);
35  * 11-Oct-2002 : Fixed errors reported by Checkstyle (DG);
36  * 14-Oct-2002 : Renamed ScatterPlotDemo2 --> ScatterPlotDemo3 (DG);
37  *
38  */

39
40 package org.jfree.chart.demo;
41
42 import org.jfree.chart.ChartFactory;
43 import org.jfree.chart.ChartPanel;
44 import org.jfree.chart.JFreeChart;
45 import org.jfree.chart.axis.NumberAxis;
46 import org.jfree.chart.plot.PlotOrientation;
47 import org.jfree.data.XYDataset;
48 import org.jfree.data.XYSeries;
49 import org.jfree.data.XYSeriesCollection;
50 import org.jfree.ui.ApplicationFrame;
51 import org.jfree.ui.RefineryUtilities;
52
53 /**
54  * Small demo to test bug report 599411.
55  *
56  * @author David Gilbert
57  */

58 public class ScatterPlotDemo3 extends ApplicationFrame {
59
60     /**
61      * A demonstration application showing a scatter plot.
62      *
63      * @param title the frame title.
64      */

65     public ScatterPlotDemo3(String JavaDoc title) {
66
67         super(title);
68         XYSeries series = new XYSeries("Test Data");
69         series.add(0.058333333333333334, 18.251567840576172);
70         series.add(0.06666666666666667, 18.32216453552246);
71         series.add(0.09166666666666666, 2.476291662324533E26); // really large value
72
series.add(0.1, 18.553701400756836);
73         series.add(0.10833333333333334, 18.60835838317871);
74         series.add(0.11666666666666667, 18.66070556640625);
75         XYDataset data = new XYSeriesCollection(series);
76         JFreeChart chart = ChartFactory.createScatterPlot(
77             "Scatter Plot Demo 3",
78             "X", "Y",
79             data,
80             PlotOrientation.VERTICAL,
81             true,
82             true,
83             false
84         );
85         NumberAxis domainAxis = (NumberAxis) chart.getXYPlot().getDomainAxis();
86         domainAxis.setAutoRangeIncludesZero(false);
87         ChartPanel chartPanel = new ChartPanel(chart);
88         setContentPane(chartPanel);
89
90     }
91
92     // ****************************************************************************
93
// * COMMERCIAL SUPPORT / JFREECHART DEVELOPER GUIDE *
94
// * Please note that commercial support and documentation is available from: *
95
// * *
96
// * http://www.object-refinery.com/jfreechart/support.html *
97
// * *
98
// * This is not only a great service for developers, but is a VERY IMPORTANT *
99
// * source of funding for the JFreeChart project. Please support us so that *
100
// * we can continue developing free software. *
101
// ****************************************************************************
102

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

108     public static void main(String JavaDoc[] args) {
109
110         ScatterPlotDemo3 demo = new ScatterPlotDemo3("Scatter Plot Demo 3");
111         demo.pack();
112         RefineryUtilities.centerFrameOnScreen(demo);
113         demo.setVisible(true);
114
115     }
116
117 }
118
Popular Tags