2013-02-25 121 views
2

我在从servlet发送的JSP页面中使用JFreeChart。从jfreechart饼图中删除灰色边框

但我无法删除图表周围的灰色边框(请参见截图)。

jfreechart with border http://www.craenhals.eu/images/jfreechart.png

我如何删除?

我用下面的代码来生成在我的servlet图表:

PiePlot plot = new PiePlot(dataset); 
    StandardPieSectionLabelGenerator labels = new StandardPieSectionLabelGenerator("{0} = {2}"); 
    plot.setLabelGenerator(labels); 
    plot.setInteriorGap(0); 
    plot.setBackgroundPaint(Color.white); 
    plot.setBaseSectionOutlinePaint(Color.blue); 
    plot.setBaseSectionPaint(Color.green); 
    plot.setShadowPaint(Color.black); 
    plot.setShadowXOffset(0); 
    plot.setShadowYOffset(0); 
    plot.setOutlineVisible(false); 


    chart = new JFreeChart("", plot); 

    chart.setPadding(new RectangleInsets(0, 0, 0, 0)); 


    chart.setBorderVisible(false); 
    chart.clearSubtitles(); 

缺少什么我在这里?我也在我的JSP中使用此代码来嵌入图像:

<img 
    src="<c:url value="/beheerder/statistieken?actie=chart_contactwijze"/>" 
    title="Contactwijze" border="0"/> 

回答

1

灰色边框是图表的背景。 要更改它,只需添加以下行:chart.setBackgroundPaint(Color.white)

6

plot.setOutlineVisible(false);

为我做了诡计。

+0

它也适用于我 – lucumt 2015-07-22 02:38:32

1
plot.setShadowPaint(null) 

这对我有效。