java 散点图_JFreeChart :快速散点图演示

/* ===========================================================

* JFreeChart : a free chart library for the Java(tm) platform

* ===========================================================

*

* (C) Copyright 2000-2004, by Object Refinery Limited and Contributors.

*

* Project Info:  http://www.jfree.org/jfreechart/index.html

*

* 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.

*

* [Java is a trademark or registered trademark of Sun Microsystems, Inc.

* in the United States and other countries.]

*

* ------------------------

* FastScatterPlotDemo.java

* ------------------------

* (C) Copyright 2002-2004, by Object Refinery Limited and Contributors.

*

* Original Author:  David Gilbert (for Object Refinery Limited);

* Contributor(s):   -;

*

* $Id: FastScatterPlotDemo.java,v 1.13 2004/04/26 19:11:54 taqua Exp $

*

* Changes (from 29-Oct-2002)

* --------------------------

* 29-Oct-2002 : Added standard header and Javadocs (DG);

* 12-Nov-2003 : Enabled zooming (DG);

*

*/

packageorg.jfree.chart.demo;

importjava.awt.RenderingHints;

importorg.jfree.chart.ChartPanel;

importorg.jfree.chart.JFreeChart;

importorg.jfree.chart.axis.NumberAxis;

importorg.jfree.chart.plot.FastScatterPlot;

importorg.jfree.ui.ApplicationFrame;

importorg.jfree.ui.RefineryUtilities;

/**

* A demo of the fast scatter plot.

*

*/

public classFastScatterPlotDemoextendsApplicationFrame{

/** A constant for the number of items in the sample dataset. */

private static finalintCOUNT =500000;

/** The data. */

privatefloat[][]data =newfloat[2][COUNT];

/**

* Creates a new fast scatter plot demo.

*

*@paramtitle  the frame title.

*/

publicFastScatterPlotDemo(finalString title) {

super(title);

populateData();

finalNumberAxis domainAxis =newNumberAxis("X");

domainAxis.setAutoRangeIncludesZero(false);

finalNumberAxis rangeAxis =newNumberAxis("Y");

rangeAxis.setAutoRangeIncludesZero(false);

finalFastScatterPlot plot =newFastScatterPlot(this.data, domainAxis, rangeAxis);

finalJFreeChart chart =newJFreeChart("Fast Scatter Plot", plot);

//        chart.setLegend(null);

// force aliasing of the rendered content..

chart.getRenderingHints().put

(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

finalChartPanel panel =newChartPanel(chart,true);

panel.setPreferredSize(newjava.awt.Dimension(500,270));

//      panel.setHorizontalZoom(true);

//    panel.setVerticalZoom(true);

panel.setMinimumDrawHeight(10);

panel.setMaximumDrawHeight(2000);

panel.setMinimumDrawWidth(20);

panel.setMaximumDrawWidth(2000);

setContentPane(panel);

}

// ****************************************************************************

// * JFREECHART DEVELOPER GUIDE                                               *

// * The JFreeChart Developer Guide, written by David Gilbert, is available   *

// * to purchase from Object Refinery Limited:                                *

// *                                                                          *

// * http://www.object-refinery.com/jfreechart/guide.html                     *

// *                                                                          *

// * Sales are used to provide funding for the JFreeChart project - please    *

// * support us so that we can continue developing free software.             *

// ****************************************************************************

/**

* Populates the data array with random values.

*/

privatevoidpopulateData() {

for(inti =0; i 

finalfloatx =(float)i +100000;

this.data[0][i]= x;

this.data[1][i]=100000+(float)Math.random()* COUNT;

}

}

/**

* Starting point for the demonstration application.

*

*@paramargs  ignored.

*/

public staticvoidmain(finalString[]args) {

finalFastScatterPlotDemo demo =newFastScatterPlotDemo("Fast Scatter Plot Demo");

demo.pack();

RefineryUtilities.centerFrameOnScreen(demo);

demo.setVisible(true);

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值