使用Java进行XY绘图 [英] XY Plotting with Java

查看:419
本文介绍了使用Java进行XY绘图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试查找有关使用Java进行绘图的一些信息 - 特别是xy绘图。我遇到过多个java库,但我不确定哪些易于学习使用/难度将它集成到现有应用程序中。

I'm trying to find some information about plotting with Java - specifically xy plotting. I've come across multiple java libraries but I'm not sure which of them are easy to learn to use/level of difficulty integrating it into an existing application.

我遇到过的是:
JFreeChart& JOpenChart

The ones I've come across are: JFreeChart & JOpenChart

我也查看了这个列表中的一些(并非所有人都有XY绘图功能): 10个适用于开发人员的优秀免费开源Java图表库

I've also looked at some in this list (not all have the XY Plot capability): 10 Excellent Free Open Source Java Chart Library for Developers

对于任何有这些经验的人是否知道哪个是最容易学习如何使用最快/最快?

Does anyone with any experience with any of these know which would be the easiest/quickest to learn how to use?

推荐答案

我已经将jfreechart用了100次用于不同的解决方案。它很容易学习,因为它有开发人员指南和Java2s.com上的更多简单教程。只是谷歌它你会发现更多
这是一个XY系列的演示

I have used jfreechart 100 times for different solutions.it is easy to learn as it has a Developer's Guide and many more easy tutorials on Java2s.com. just google it and you will find much more Here is a demo of XY series

 package org.jfree.chart.demo;

 import org.jfree.chart.ChartFactory;
 import org.jfree.chart.ChartPanel;
 import org.jfree.chart.JFreeChart;
 import org.jfree.chart.plot.PlotOrientation;
 import org.jfree.data.xy.XYSeries;
 import org.jfree.data.xy.XYSeriesCollection;
 import org.jfree.ui.ApplicationFrame;
 import org.jfree.ui.RefineryUtilities;


public class XYSeriesDemo extends ApplicationFrame {

/**
 * A demonstration application showing an XY series containing a null value.
 *
 * @param title  the frame title.
 */
public XYSeriesDemo(final String title) {

    super(title);
    final XYSeries series = new XYSeries("Random Data");
    series.add(1.0, 500.2);
    series.add(5.0, 694.1);
    series.add(4.0, 100.0);
    series.add(12.5, 734.4);
    series.add(17.3, 453.2);
    series.add(21.2, 500.2);
    series.add(21.9, null);
    series.add(25.6, 734.4);
    series.add(30.0, 453.2);
    final XYSeriesCollection data = new XYSeriesCollection(series);
    final JFreeChart chart = ChartFactory.createXYLineChart(
        "XY Series Demo",
        "X", 
        "Y", 
        data,
        PlotOrientation.VERTICAL,
        true,
        true,
        false
    );

    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
    setContentPane(chartPanel);

}

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

/**
 * Starting point for the demonstration application.
 *
 * @param args  ignored.
 */
public static void main(final String[] args) {

    final XYSeriesDemo demo = new XYSeriesDemo("XY Series Demo");
    demo.pack();
    RefineryUtilities.centerFrameOnScreen(demo);
    demo.setVisible(true);

}

}

这篇关于使用Java进行XY绘图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆