It's not a secret anymore!*
The moose likes Java in General and the fly likes Java Graphs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java Graphs" Watch "Java Graphs" New topic
Author

Java Graphs

Dinesh Bhogle
Greenhorn

Joined: Mar 12, 2001
Posts: 6
How to draw a graph in java? If it is possible please provide
with code
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
I am moving this discussion to Java in General(intermediate).

Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Dinesh,
Yes, of course it is possible to draw a graph in Java... I can't really provide you with code because the question is too general... It depends on how you want to do it... Do you want to draw a bar graph, a pie chart, a line graph, etc.? You can also create a custom component that will display a graph, or just have the graph hard coded into your application. Personally, I would make a component that could be added to any application ( more OO, and easier to reuse! ) and use some type of collection inside to save all the graphs, their values and associated colors inside the component. I would then have the paint() method of the component go through all the graph values and paint them however you wanted. (points, lines between points, filled rectangles, arcs, etc. , depending on the type of graph you want...)
HTH,
-Nate


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Tony Alicea
Desperado
Sheriff

Joined: Jan 30, 2000
Posts: 3222
    
    5
Look at my Sine Waves... Source code included...
http://www.geocities.com/~tony-alicea/SineTest.html


Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
Tim Collins
Greenhorn

Joined: May 31, 2001
Posts: 9
Hopefully someone still looks here I see the last entry was the 16th. I need help creating a graph with a Java program/applet. Right now, I am looking at the need for a dynamic line graph, based on data that is acquired from a file. Examples would be fantastic, but a resource where I could possibly find this info would also be helpful. (ASAP)
Thanks
Tim Collins
Val Dra
Ranch Hand

Joined: Jan 26, 2001
Posts: 439
Hi please give me your email id and i can send you both line graph and bar graph they are simple but give you an idea how to do them.


Val SCJP <BR>going for SCJD
Val Dra
Ranch Hand

Joined: Jan 26, 2001
Posts: 439
i send you an email.
Tim Collins
Greenhorn

Joined: May 31, 2001
Posts: 9
email: tcollins@vtc.vsc.edu
thanks
gaurav chaudhary
Ranch Hand

Joined: Jun 24, 2002
Posts: 64
can u please send me also the code for this chaudharygaurav@yahoo.com


gaurav
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

Originally posted by gaurav chaudhary:
can u please send me also the code for this chaudharygaurav@yahoo.com

This link may be of interest for you. JFreeChart is a free graphing tool. Not sure how good it is, but have a look.
Jamie
Jaume Sola
Greenhorn

Joined: Jan 21, 2003
Posts: 14
You can try RChart
it includes a Visual Tool for building the charts. Then you canuse the charts very easily as servlet, applet or bean.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java Graphs
 
Similar Threads
class
WA #2 ..... word association
c++ or Java--your suggestions please
zipping as self extracting exe
J2EE