469,358 Members | 1,583 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,358 developers. It's quick & easy.

Drawing graph charts using swings

hi friends, i have just moved from vba to java. i am quite new to java. but unexpectedly i was given a task to build a chart for a table stored in oracle database.

we have to use only swings technology.
and now my task is,

There will be a table in oracle database.
i have to draw a line chart for that table and show to user.

can any body place me in the correct track towards the solution.


thank you

.
Oct 31 '07 #1
11 4018
r035198x
13,262 8TB
hi friends, i have just moved from vba to java. i am quite new to java. but unexpectedly i was given a task to build a chart for a table stored in oracle database.

we have to use only swings technology.
and now my task is,

There will be a table in oracle database.
i have to draw a line chart for that table and show to user.

can any body place me in the correct track towards the solution.


thank you

.
By line chart you mean a line graph?
Have a look at the g.drawPolyLine method in the Graphics class.
Oct 31 '07 #2
By line chart you mean a line graph?
Have a look at the g.drawPolyLine method in the Graphics class.


Yes line graph(infact i have to draw line and bar graph).
i have table with two columns.
i have to draw line and bar graphs.

how can i make this using that method?


Thank you
Oct 31 '07 #3
r035198x
13,262 8TB
Yes line graph(infact i have to draw line and bar graph).
i have table with two columns.
i have to draw line and bar graphs.

how can i make this using that method?


Thank you
Did you read the specs for that method then?
Oct 31 '07 #4
Did you read the specs for that method then?
The method goes like this

************************************************** ****

public abstract void drawPolyline(int[] xPoints,
int[] yPoints,
int nPoints)Draws a sequence of connected lines defined by arrays of x and y coordinates. Each pair of (x, y) coordinates defines a point. The figure is not closed if the first point differs from the last point.

Parameters:
xPoints - an array of x points
yPoints - an array of y points
nPoints - the total number of points
************************************************** ******************

now, do you mean that i have to put my first column values into xPoints, and second column values into yPoints?
also what is nPoints?
Oct 31 '07 #5
r035198x
13,262 8TB
The method goes like this

************************************************** ****

public abstract void drawPolyline(int[] xPoints,
int[] yPoints,
int nPoints)Draws a sequence of connected lines defined by arrays of x and y coordinates. Each pair of (x, y) coordinates defines a point. The figure is not closed if the first point differs from the last point.

Parameters:
xPoints - an array of x points
yPoints - an array of y points
nPoints - the total number of points
************************************************** ******************

now, do you mean that i have to put my first column values into xPoints, and second column values into yPoints?
also what is nPoints?
The last line of the text you posted above says
nPoints - the total number of points
You have to set up somewhere to draw this of course, perhaps a Canvas (look it up) and then use it's graphics object to do the painting.
Oct 31 '07 #6
JosAH
11,448 Expert 8TB
Don't reinvent the wheel: use JFreeChart (or similar packages) instead.
It uses just Swing for the actual rendering.

kind regards,

Jos
Oct 31 '07 #7
The last line of the text you posted above says


You have to set up somewhere to draw this of course, perhaps a Canvas (look it up) and then use it's graphics object to do the painting.

Ok thank you.
i will do that.
Oct 31 '07 #8
r035198x
13,262 8TB
Ok thank you.
i will do that.
You should also consider the JFreeChart option suggested above. You are allowed to use it, right?
Oct 31 '07 #9
JosAH
11,448 Expert 8TB
You have to set up somewhere to draw this of course, perhaps a Canvas (look it up) and then use it's graphics object to do the painting.
For Swing, better use a JPanel

kind regards,

Jos
Oct 31 '07 #10
You should also consider the JFreeChart option suggested above. You are allowed to use it, right?

JFreeChart?

is that a external application? (please dont mind, i dont know)
i have searched for it in google and could find only demo version.
demo version allowed me to view charts but not the code.
Oct 31 '07 #11
r035198x
13,262 8TB
JFreeChart?

is that a external application? (please dont mind, i dont know)
i have searched for it in google and could find only demo version.
demo version allowed me to view charts but not the code.
Did you open the link posted by Jos above?
Nov 1 '07 #12

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by SS KANAGAL | last post: by
1 post views Thread by JD Kronicz | last post: by
6 posts views Thread by David W. Fenton | last post: by
2 posts views Thread by san1014 | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.