想请问jfreechart如何在MultiplePiePlot设定颜色?因为MultiplePiePlot没有setSectionPaint(),那该如何解决呢?此外,饼图的饼分也不一样,而颜色是要依照组别来设定的。我想要设定的颜色是这样的。。可以给些代码参考吗?谢谢!
[b]问题补充:[/b]
想请问jfreechart如何在MultiplePiePlot设定颜色?因为MultiplePiePlot没有setSectionPaint(),那该如何解决呢?此外,饼图的饼分也不一样,而颜色是要依照组别来设定的。我想要设定的颜色是这样的。。可以给些代码参考吗?谢谢!
我想要的是依组别来设定颜色,不是依饼图的Section因为第一个多重饼图可能有B,C和A,B,C,D。。第二个多重饼图有C,D 和A,B,C..而颜色是要依
A-红
B-蓝
C-黄
D-绿
由谁会吗?
[code="java"]
try
{
vMultiplePiePlot=(MultiplePiePlot)vFreeChart.getPlot();
if(vMultiplePiePlot!=null)
{
vFreeChartExtend=vMultiplePiePlot.getPieChart();
vPiePlot=(PiePlot)vFreeChartExtend.getPlot();
if(bRender)
{
if(strItemArray.length>0)
{
for(int iIndex=0;iIndex<strItemArray.length;iIndex++)
{
//指定Section色彩
vPiePlot.setSectionPaint(iIndex,new Color(0,0+iIndex*(255/strItemArray.length),255));
//指定Section轮廓线颜色
vPiePlot.setSectionOutlinePaint(0,Color.BLACK);
}
}
}
//指定Section标签格式
vStandardPieItemLabelGenerator=new StandardPieItemLabelGenerator("{1}");
vPiePlot.setLabelGenerator(vStandardPieItemLabelGenerator);
vPiePlot.setForegroundAlpha(0.5f);
}
}
[/code]