1

I am using Jfreechart to create a pie chart in Spring MVC. MY requirement is:

i have to create two section,FOUND and LOST on pie chart.also in,LOST section i need to create more sections representing Count of different LOST items. here

right now,i am able to create two sections on chart,FOUND and LOST. but i am not getting how to do partition of LOST section on same chart. How can i achieve this..please help

nidhi
  • 333
  • 2
  • 9
  • 17
  • Please edit your question to include an [sscce](http://sscce.org/) that shows your current approach. – trashgod Dec 05 '12 at 19:39

1 Answers1

1

You may have started with org.jfree.chart.demo.PieChartDemo1, as the source is include in the distribution. Unfortunately, DefaultPieDataset does not support sub-categories suitable for partitioning.

Here's an outline of one approach:

  • Extend DefaultPieDataset to include the data required to model the partition, e.g. Set<String> lostand Set<String> found, representing the set of keys belonging to each partition.

  • Use a palette or related colors to show related items, e.g. shades of red for lost and shades of blue for found. This example illustrates the approach for GanttRenderer using a palette of varying saturation. This example illustrates the approach for XYItemRenderer using a palette of varying hue. Naturally, you'll need to override getSectionPaint() instead of getItemPaint().

image

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045