Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to Plot Simple Line Chart/Graph in Java

807588Aug 11 2009 — edited Aug 11 2009
Hi All, I hope someone can offer some help / advice.

I need to plot a fairly simple line chart/graph, using some data generated previously from another Java program (run from the console) that is output to a text file.

I'm really struggling trying to produce a viewable line chart/graph in Java.

It basically needs an x axis and a y axis, and will have various pairs of points to be plotted on these.

The only requirement really is to have different coloured lines (and possibly different lines - e.g. solid, dashed, dotted)

I've spent the past 6 hours researching this, and trying many packages (SGT, jfreechart etc), and so far haven't got anything to work (though I'm not sure what I'm doing is correct)

Can anyone point me in the direction of an example / tutorial, that will produce a line graph (prefereably using what comes with java - or if some external package is needed - full instructions on how to use it)? A "chart building for dummies" type resource?

If I could just find some code that worked to produce a simple line graph, I could then look to extend it to fit my needs

I'm fairly confident with Java itself (though have never developed an applet before), but this has really stumped me

Jonny
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 8 2009
Added on Aug 11 2009
2 comments
962 views