3

我在从 servlet 发送的 JSP 页面中使用 JFreeChart。

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

jfreechart 带边框 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"/>
4

3 回答 3

8

plot.setOutlineVisible(false);

为我做了伎俩。

于 2013-06-18T13:26:22.770 回答
5
plot.setShadowPaint(null)

这对我有用。

于 2017-05-31T11:51:46.840 回答
1

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

于 2013-02-26T08:47:57.083 回答