JFreeChart Eg with MySQL ?

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

JFreeChart Eg with MySQL ?

Post by zw » Thu Jan 23, 2003 9:48 pm

Is there anyone willing to share with the forum on
how to implement a line chart and a pie chart with MySQL ?

David Gilbert

Re: JFreeChart Eg with MySQL ?

Post by David Gilbert » Fri Jan 24, 2003 10:29 am

You can use the JdbcPieDataset and JdbcCategoryDataset classes to read tables directly into datasets, or write your own code to query the database and feed data into a dataset class.

I've written up examples in the JFreeChart Developer Guide using PostgreSQL, but thanks to JDBC the same code should work against most databases as long as you have the correct JDBC driver...

Regards,

Dave Gilbert

zw

Re: JFreeChart Eg with MySQL ?

Post by zw » Fri Jan 24, 2003 4:12 pm

Dave
Thanks for your response.
But it would be great if you could provide examples on
how to use your
JdbcPieDataset and JdbcCategoryDataset.

I would luv to purchase your 200 page JFreeChart Developer Guide or
JFreeChart Documentation, but $ is tight for me now.

David Gilbert

Re: JFreeChart Eg with MySQL ?

Post by David Gilbert » Fri Jan 24, 2003 5:15 pm

zw wrote:
> $ is tight for me now.

For me also.

zw

Re: JFreeChart Eg with MySQL ?

Post by zw » Fri Jan 24, 2003 5:31 pm

Dave
Hope u didnt take that personally.
Sorry if u did.

Thanks

zw

Re: JFreeChart Eg with MySQL ?

Post by zw » Fri Jan 24, 2003 7:10 pm

After executing executeQuery, should one recreate JdbcCategoryDataset to assign the resultSet in executeQuery ?

Does one need to convert between datasets from jdbcCategoryDataset
to another dataset, say piedataset in order to draw a pie chart ?

David Gilbert

Re: JFreeChart Eg with MySQL ?

Post by David Gilbert » Mon Jan 27, 2003 9:42 pm

From my reading of the code (I didn't write it), it looks as though the query runs once and what you are left with is a DefaultCategoryDataset.

There are methods in the DatasetUtilities class to copy data from any CategoryDataset into a new PieDataset.

You can also create a "multi" pie chart using the CategoryDataset directly.

I did some editing of the JDBCCategoryDataset and JDBCPieDataset classes to simplify them slightly for the 0.9.5 release, also to reflect some changes that I've made to the interfaces.

Regards,

Dave Gilbert

Locked