how set different render to each series of a dataset

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
sdotolo
Posts: 4
Joined: Mon Jul 19, 2004 4:31 pm

how set different render to each series of a dataset

Post by sdotolo » Tue Aug 10, 2004 10:18 am

hi, i'm trying to represent a graph where the dataset is retrieved from a database source via query by one of the classes of type JDBC??Dataset supplied with jfreechart 0.9.20. Ok, suppose my query return 4 columns; the first is for the x-axis and the others are for y-axis i.e. series to display. If i'm not wrong, once i call ChartFactory.create??Chart passing to it the dataset, i can display the chart but with all series rendered to the same type of graphic (i.e. lines or area ora pie ecc...) defined in the method, or also after, setting the renderer.
However If i want to display each one of the series with different type of graphics (i.e the first series line, the second area, ecc..) how i can achieve this?
i'll appreciate a lot your help because is crucial for me resolve this kind of problem. I have looked for the solution but the only one found was to create different dataset for each series and set these ones with different renderer but i do not want to call a lot of time the database query when i can retrieve all series with only one query!

thanks a lot.

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Tue Aug 10, 2004 10:21 am

You have to use three separate datasets. But I don't see a problem retrieving all the data from the dataset in one go, then processing it to put it into three separate datasets.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

sdotolo
Posts: 4
Joined: Mon Jul 19, 2004 4:31 pm

Post by sdotolo » Tue Aug 10, 2004 11:50 am

thanks a lot for your fast reply! :-))))
i'm tested some code and seems to work now, but i want to reply with a question.
Why there isn't any method to extract an entire Series from a dataset? to achieve what you explained me before i had to copy every cell for every series in the first dataset due attention also of the kind of x-value for the series (for my example x-value was a RegularTimePeriod).
I have done well or this method exist and i was poor in looking at the classes methods?
Infact why do this if the original dataset contains yet all what i want to split into different datasets?

thanks a lot anyway for your first solution.

Locked