18

The Java Swing GUI that I'm developing needs to plot a 2D graph based on the x and y coordinates generated in the program.

Is there a Swing component for that?

Or is there any other open source package for the purpose?

Socowi
  • 25,550
  • 3
  • 32
  • 54
PKay
  • 433
  • 3
  • 9
  • 20

4 Answers4

31

You should check out JFreeChart which has Swing support. Here are some samples:

http://www.jfree.org/jfreechart/samples.html

Olly
  • 7,732
  • 10
  • 54
  • 63
17

You should look at JFreeChart.

Mark
  • 28,783
  • 8
  • 63
  • 92
11

check out the feature comparison for Java report and charting libraries; http://java-source.net/open-source/charting-and-reporting

n002213f
  • 7,805
  • 13
  • 69
  • 105
1

Here is a related answer of me: I have summary of existing tools and show a alternative option to create interactive charts with Gnuplot in a JPanel

Java 3D plot library?

For your case (2d charts) JFreeChart is OK. But sometimes JFreeChart is overkill for simple charts.

Community
  • 1
  • 1
timaschew
  • 16,254
  • 6
  • 61
  • 78