【问题标题】:Remove grey border from jfreechart Piechart从 jfreechart Piechart 中删除灰色边框
【发布时间】:2013-02-25 23:28:24
【问题描述】:

我在从 servlet 发送的 JSP 页面中使用 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"/>

【问题讨论】:

    标签: java jakarta-ee jfreechart


    【解决方案1】:

    plot.setOutlineVisible(false);

    为我做了诀窍。

    【讨论】:

      【解决方案2】:
      plot.setShadowPaint(null)
      

      这对我有用。

      【讨论】:

        【解决方案3】:

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

        【讨论】: