Dataset vs Collections

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
mina.

Dataset vs Collections

Post by mina. » Wed Oct 23, 2002 9:51 pm

Hi,

I need to create some charts based on data from a database server. I'd like to use a JDBCXYDataset to store my values, but was wondering a few things. Currently, I am retrieving the data, storing it in an XYSeries[] and then adding that to any XYSeriesCollection because each series represents data for a particular machine. In the resulting graph, I have a bunch of lines that shows my data.

When executing queries using JDBCXYDataset, will I still be able to have different series represented on the same graph? If not, is there some way I can get around this?

Thanks,
mina.

Dave Gilbert

Re: Dataset vs Collections

Post by Dave Gilbert » Wed Oct 23, 2002 10:27 pm

The JdbcXYDataset class and the XYSeriesCollection class both implement the XYDataset interface, so either can be used for the charts that need an XYDataset.

I haven't used JdbcXYDataset myself, but I believe it takes the results of a database query and converts the first column into x-values and each of the remaining columns into the y-values for a series in the dataset (so n columns becomes n-1 series in the dataset). Based on that, I think it should be possible to do what you want.

Regards,

DG.

Locked