Discussion Locked

How to draw a graph?

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
Does anyone know if there is an API out there to draw a graph (X-Y plot)?

6 replies

by jay eckles

You should take a look at the Java 2D package available at
http://java.sun.com/products/java-media/2D/index.html (remember to remove any spaces in that URL).

It is an API in Java for creating and maniuplating 2D images. There are also some capabilities built into the AWT framework that is a standard part of the Java SDK. Specifically, look at the documentation for the Component, Graphics2D, Paint, Image, Polygone, and similar classes and interfaces in the java.awt package.

I'd recommend taking the Java 2D trail tutorial at java.sun.com or getting a good book on AWT, depending on which package you use.

Good luck.

Jay Eckles
www.jayeckles.com

by jay eckles

By the way, if you'd like someone to create a custom package to abstract all of the gory details of Java 2D or AWT and basically provide methods to define the scale of the plot, the colors, the axis units and definitions, and other options, then draw the graph, let me know. I do custom Java (and other) programming. You can visit my website at www.jayeckles.com to get information on rates, qualifications, etc.

by rrosulescu

I find today an interesting package that helps you produce charts. Here is a short description:

JOpenChart Java Charting Library and Toolkit (SM42-1)
The JOpenChart Library and Toolkit provides the means to embed charts into all kinds of applications. It contains classes and components to include charts in Web or Swing Applications. The features of the charting library include line charts, pie charts, plot charts, polynomial interpolation of data, plotting of mathematical functions and an easy class structure that can be extended in many ways. The Renderer Interface API makes it extremely easy to add new chart rendering styles.

It seems to be in the early stage but may be can help you. You?ll find at http://jopenchart.sourceforge.net/
I?ll be grateful if you?ll send me an e-mail to tell if it works and how it works.

This discussion is closed to new replies.