Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Graphs

 
Dinesh Bhogle
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to draw a graph in java? If it is possible please provide
with code
 
Ajith Kallambella
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am moving this discussion to Java in General(intermediate).
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Tony Alicea
Desperado
Sheriff
Posts: 3226
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at my Sine Waves... Source code included...
http://www.geocities.com/~tony-alicea/SineTest.html
 
Tim Collins
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 439
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 Dra
Ranch Hand
Posts: 439
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i send you an email.
 
Tim Collins
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
email: tcollins@vtc.vsc.edu
thanks
 
gaurav chaudhary
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can u please send me also the code for this chaudharygaurav@yahoo.com
 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic