2013-02-25 124 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) 

這對我有效。