📄 fastscatterplotdemo.java
字号:
/* ======================================
* JFreeChart : a free Java chart library
* ======================================
*
* Project Info: http://www.jfree.org/jfreechart/index.html
* Project Lead: David Gilbert (david.gilbert@object-refinery.com);
*
* (C) Copyright 2000-2003, by Object Refinery Limited and Contributors.
*
* This library is free software; you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Foundation;
* either version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this
* library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*
* ------------------------
* FastScatterPlotDemo.java
* ------------------------
* (C) Copyright 2002, 2003, by Object Refinery Limited and Contributors.
*
* Original Author: David Gilbert (for Object Refinery Limited);
* Contributor(s): -;
*
* $Id: FastScatterPlotDemo.java,v 1.3 2003/05/29 15:23:32 mungady Exp $
*
* Changes (from 29-Oct-2002)
* --------------------------
* 29-Oct-2002 : Added standard header and Javadocs (DG);
*
*/
package org.jfree.chart.demo;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.NumberAxis;
import org.jfree.chart.axis.ValueAxis;
import org.jfree.chart.plot.FastScatterPlot;
import org.jfree.ui.ApplicationFrame;
import org.jfree.ui.RefineryUtilities;
/**
* A demo of the fast scatter plot.
*
* @author David Gilbert
*/
public class FastScatterPlotDemo extends ApplicationFrame {
/** A constant for the number of items in the sample dataset. */
private static final int COUNT = 1440;
/** The data. */
private float[][] data = new float[2][COUNT];
/**
* Creates a new fast scatter plot demo.
*
* @param title the frame title.
*/
public FastScatterPlotDemo(String title) {
super(title);
populateData();
ValueAxis domainAxis = new NumberAxis("X");
// domainAxis.setRange(0, (double) COUNT);
ValueAxis rangeAxis = new NumberAxis("Y");
// rangeAxis.setRange(0, 100 + 3 * (double) COUNT);
FastScatterPlot plot = new FastScatterPlot(data, domainAxis, rangeAxis);
JFreeChart chart = new JFreeChart("Fast Scatter Plot",
JFreeChart.DEFAULT_TITLE_FONT,
plot, false);
ChartPanel panel = new ChartPanel(chart, false);
panel.setPreferredSize(new java.awt.Dimension(500, 270));
setContentPane(panel);
}
/**
* Populates the data array with random values.
*/
private void populateData() {
for (int i = 0; i < data[0].length; i++) {
float x = (float) i + 100;
data[0][i] = x;
data[1][i] = 100 + (float) Math.random() * COUNT;
}
}
/**
* Starting point for the demonstration application.
*
* @param args ignored.
*/
public static void main(String[] args) {
FastScatterPlotDemo demo = new FastScatterPlotDemo("Fast Scatter Plot Demo");
demo.pack();
RefineryUtilities.centerFrameOnScreen(demo);
demo.setVisible(true);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -