Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / March 2005

Tip: Looking for answers? Try searching our database.

Simple XY Plot

Thread view: 
Kenneth Jacker - 28 Mar 2005 15:51 GMT
Though I've done the usual "web search" and found jFreeChart, jCharts,
and PlotPackage, I thought I'd post here in case I've missed any
options for a simple, free two axis XY plotting package/class.

jFreeChart is overkill ... the other two look like possibilities.

Of course, I can just use AWT's Graphics or Graphics3d class, but am
hoping to find a slighter higher-level implementation.

Thanks for your ideas!

Signature

Prof Kenneth H Jacker       khj@cs.appstate.edu
Computer Science Dept       www.cs.appstate.edu/~khj
Appalachian State Univ
Boone, NC  28608  USA        

David Gilbert - 28 Mar 2005 22:45 GMT
> Though I've done the usual "web search" and found jFreeChart, jCharts,
> and PlotPackage, I thought I'd post here in case I've missed any
> options for a simple, free two axis XY plotting package/class.
>
> jFreeChart is overkill ...

JFreeChart is a big library, but we work hard to make it use sensible
defaults so that you don't have to write a lot of code to get great
looking charts.  For example, here is a scatter plot demo written using
the JFreeChart API:

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 ScatterPlotDemo extends ApplicationFrame {

    public ScatterPlotDemo(String title) {

        super(title);

        XYSeriesCollection dataset = new XYSeriesCollection();

        XYSeries series1 = new XYSeries("Series 1");
        series1.add(1.0, 4.5);
        series1.add(4.4, 3.2);
        dataset.addSeries(series1);

        XYSeries series2 = new XYSeries("Series 2");
        series2.add(3.2, 8.5);
        series2.add(4.9, 3.7);
        dataset.addSeries(series2);

        JFreeChart chart = ChartFactory.createScatterPlot(
            "Scatter Plot Demo",  // title
            "X", "Y",             // axis labels
            dataset,              // dataset
            PlotOrientation.VERTICAL,
            true,                 // legend? yes
            true,                 // tooltips? yes
            false                 // URLs? no
        );
        ChartPanel chartPanel = new ChartPanel(chart);
        chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
        setContentPane(chartPanel);

    }

    public static void main(String[] args) {
        ScatterPlotDemo demo = new ScatterPlotDemo("Scatter Plot Demo");
        demo.pack();
        RefineryUtilities.centerFrameOnScreen(demo);
        demo.setVisible(true);
    }

}

I hope you'll give JFreeChart a try!

Regards,

Dave Gilbert
JFreeChart Project Leader
Thomas Weidenfeller - 29 Mar 2005 08:11 GMT
> Of course, I can just use AWT's Graphics or Graphics3d class, but am
> hoping to find a slighter higher-level implementation.

Pipe the data into good olf gnuplot if you can live with an non all-Java
 solution and a separate application.

/Thomas

Signature

The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.