how to do partition of existing jfree pie Chart section on same chart

橙三吉。 提交于 2019-12-11 10:25:19

问题


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


回答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().



来源:https://stackoverflow.com/questions/13703041/how-to-do-partition-of-existing-jfree-pie-chart-section-on-same-chart

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!