Java School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a Java Expert!

Join 306,824 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 1,750 people online right now. Registration is fast and FREE... Join Now!




Getting java to read data from postgresql and plot a graph

 

Getting java to read data from postgresql and plot a graph

andrewktmeikle

28 Aug, 2008 - 06:24 AM
Post #1

New D.I.C Head
*

Joined: 28 Feb, 2008
Posts: 8

Hey all,
I've just finished one task and have been set another. The inital task was to read data stored in a table in postgresql. That, i've done. The second task was to, then, plot a graph from the data stored in the postgresql table.
I've been searching around online to find some source code, not an applet or a servlet and the solution seems, not non-existent, invisible to the needy.

Even though it does say in nice BOLD letter "We Will Not Do Your Homework" i'm just looking for some helpful source code sites that you programmers have been to and trust for reliability that could aid in plotting a graph from the conents of a postgresql table.

I'm a relative beginner so if the solution to the problem is simple and illudes me also make that clear.

Thanks very much.

User is offlineProfile CardPM
+Quote Post


1lacca

RE: Getting Java To Read Data From Postgresql And Plot A Graph

28 Aug, 2008 - 06:31 AM
Post #2

code.rascal
Group Icon

Joined: 11 Aug, 2005
Posts: 3,822



Thanked: 33 times
My Contributions
Jasperreports?
User is offlineProfile CardPM
+Quote Post

JeroenFM

RE: Getting Java To Read Data From Postgresql And Plot A Graph

28 Aug, 2008 - 08:05 AM
Post #3

D.I.C Head
Group Icon

Joined: 30 Jun, 2008
Posts: 195



Thanked: 14 times
Dream Kudos: 100
My Contributions
QUOTE(1lacca @ 28 Aug, 2008 - 07:31 AM) *

Jasperreports?


JasperReports uses JFreeChart. At least I'm guessing he meant a chart. If it's an actual graph (you know, Vertices and Edges) he wants, then he could try JGraph.

This post has been edited by JeroenFM: 28 Aug, 2008 - 08:13 AM
User is offlineProfile CardPM
+Quote Post

pbl

RE: Getting Java To Read Data From Postgresql And Plot A Graph

28 Aug, 2008 - 02:13 PM
Post #4

Java Lover
Group Icon

Joined: 6 Mar, 2008
Posts: 9,962



Thanked: 1187 times
Dream Kudos: 450
My Contributions
java.awt.graphics.drawPolyline()
User is online!Profile CardPM
+Quote Post

andrewktmeikle

RE: Getting Java To Read Data From Postgresql And Plot A Graph

9 Oct, 2008 - 01:10 AM
Post #5

New D.I.C Head
*

Joined: 28 Feb, 2008
Posts: 8

yes, i was looking for a graph with " vertices and edges" eg x and y axis.
Trouble is I can't use an external applet to do it, I was not sure if their was a specific swing component that you can draw, and accuratly place, points on a graph in relation to fixed axis. I do know about "drawLine" but I wasn't sure if there was a more accurate way of doing it.

The java tutorials on the sun site, do not deal with these issues and i'm having touble generalising their solution.
Thanks again for the help

This post has been edited by andrewktmeikle: 9 Oct, 2008 - 01:35 AM
User is offlineProfile CardPM
+Quote Post

andrewktmeikle

RE: Getting Java To Read Data From Postgresql And Plot A Graph

9 Oct, 2008 - 01:19 AM
Post #6

New D.I.C Head
*

Joined: 28 Feb, 2008
Posts: 8

QUOTE(pbl @ 28 Aug, 2008 - 03:13 PM) *

java.awt.graphics.drawPolyline()


From what i've read since your comment, i've gathered that drawPolyline is used when you want to draw connected lines. Granted i will need to do this at a later stage but at the moment i just want to use a swing component, if there is absolutly no choice then i will use an applet, to accruate draw axes with measurements(which is what i would be creating inside a swing component of some kind) and be able to use said measurements to plot a line graph( hence i will need drawpolyline later on)
User is offlineProfile CardPM
+Quote Post

JeroenFM

RE: Getting Java To Read Data From Postgresql And Plot A Graph

9 Oct, 2008 - 06:14 AM
Post #7

D.I.C Head
Group Icon

Joined: 30 Jun, 2008
Posts: 195



Thanked: 14 times
Dream Kudos: 100
My Contributions
QUOTE(andrewktmeikle @ 9 Oct, 2008 - 02:10 AM) *

yes, i was looking for a graph with " vertices and edges" eg x and y axis.
Trouble is I can't use an external applet to do it, I was not sure if their was a specific swing component that you can draw, and accuratly place, points on a graph in relation to fixed axis. I do know about "drawLine" but I wasn't sure if there was a more accurate way of doing it.

The java tutorials on the sun site, do not deal with these issues and i'm having touble generalising their solution.
Thanks again for the help


I think you misunderstood me, I was talking about mathematical graphs: http://en.wikipedia.org/wiki/Graph_(mathematics), while I think you're talking about a http://en.wikipedia.org/wiki/Graph_of_a_function.

To do the former, uses JGraph, to do the latter, use JFreeChart. Or you can just draw on a component manually using Graphics objects.


User is offlineProfile CardPM
+Quote Post

andrewktmeikle

RE: Getting Java To Read Data From Postgresql And Plot A Graph

10 Oct, 2008 - 02:03 AM
Post #8

New D.I.C Head
*

Joined: 28 Feb, 2008
Posts: 8

QUOTE

I think you misunderstood me, I was talking about mathematical graphs: http://en.wikipedia.org/wiki/Graph_(mathematics), while I think you're talking about a http://en.wikipedia.org/wiki/Graph_of_a_function.


yeah I believe i did misunderstand you tongue.gif i do indeed wish to draw the graph of a function. So their isn't any easier, excluding a applet, that will help me draw graph, no specific swing components or anything? I just have to battle away manually draw grid lines etc?

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/20/09 10:35PM

Live Java Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month