PieDataset & CategoryDataset interface design

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

PieDataset & CategoryDataset interface design

Post by Andy » Fri Apr 26, 2002 6:55 pm

David,

Could you please explaing the reason why PieDataset, which it actually a simplified version of CategoryDataset, has Set as a return value of getCategories, while CategoriyDataset has List?

This fact prohibits creating one class (e.g. JDBCChartAdapter) that implements both interfaces.

BTW, PieDataset may be even obsoleted if create*PieChart* will use CategoryDataset...

Thanks
Andy

Andy

Re: PieDataset & CategoryDataset interface design

Post by Andy » Sat Apr 27, 2002 12:02 am

David,

I have update PieDataset to inherit CategoryDataset and tweaked few other files a little bit.

Now PieCharts could be created from JDBCChartAdapter.

If you are interested, I could send you updated files.

Thanks
Andy

David Gilbert

Re: PieDataset & CategoryDataset interface design

Post by David Gilbert » Mon Apr 29, 2002 5:52 am

The PieDataset class was updated recently to return a List for the getCategories() method...you can see the code in CVS on SourceForge.

In the DatasetUtilities class, you will find a couple of methods for creating a PieDataset from one "slice" of a CategoryDataset (all the categories for one series, or all the series for one category). You could base a PiePlot on a CategoryDataset, but then you would need extra code in PiePlot to determine which series should be used for the plot...I preferred to create a special dataset (PieDataset) and provide conversion methods for those that need or want them.

Regards,

DG.

Locked