Newbie question about Pie Charts

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

Newbie question about Pie Charts

Post by Slimane » Thu Mar 14, 2002 3:35 pm

Hi,

I managed to display my Pie Chart. But, I don't find how I can set the names for the categories of my Pie.

Now, it's only displaying category 1, category 2, and so on.

Any pointer, would be greatly appreciated :)

Also, is there a good tutorial about JFreeChart on the Internet ?

Thanx in advance,
Slimane

David Gilbert

Re: Newbie question about Pie Charts

Post by David Gilbert » Thu Mar 14, 2002 5:30 pm

Here's the simplest way to create a PieDataset:

// create a dataset...
DefaultPieDataset data = new DefaultPieDataset();
data.setValue("Category 1", new Double(43.2));
data.setValue("Category 2", new Double(27.9));
data.setValue("Category 3", new Double(79.5));

// create a chart...
JFreeChart chart = ChartFactory.createPieChart("Sample Pie Chart", data, true);
You can use whatever names you like for the categories.

There is a document explaining how to use JFreeChart available for sale from the JFreeChart page. The cost is US$30 per (electronic) copy, the proceeds are used to cover the costs of running this site.

Regards,

Dave Gilbert

Locked