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
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> lost
andSet<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 forfound
. This example illustrates the approach forGanttRenderer
using a palette of varying saturation. This example illustrates the approach forXYItemRenderer
using a palette of varying hue. Naturally, you'll need to overridegetSectionPaint()
instead ofgetItemPaint().