自定义环形图表

时间:2017-11-20 10:17:15

标签: java jfreechart

我是JFreeChart的新手。我正在JFreeChart中创建一个自定义的环形图表。我没有得到预期的输出。

private static JFreeChart createChart(PieDataset dataset) {
    CustomRingPlot plot = new CustomRingPlot(dataset);

    JFreeChart chart = new JFreeChart("Custom Ring Chart", 
            JFreeChart.DEFAULT_TITLE_FONT, plot, false);  

    plot.setBackgroundPaint(null);
    plot.setOutlineVisible(false);
    plot.setLabelGenerator(null);
    plot.setSectionPaint("A", Color.ORANGE);
    plot.setSectionPaint("B", new Color(100, 100, 100));
    plot.setSectionDepth(0.50);
    plot.setSectionOutlinesVisible(false);
    plot.setShadowPaint(null);
    plot.setSeparatorsVisible(false);
    plot.setExplodePercent("A", 0.05);
    plot.setExplodePercent("B", 0.05);
    plot.setAutoPopulateSectionOutlinePaint(true);
    plot.setSimpleLabels(true);

    return chart;
}

预期产出:

expected output

实际输出:

actual output

0 个答案:

没有答案