JFreeChart 中没有标签的饼图

Pie Chart without labels in JFreeChart

我需要创建这样的饼图,但没有标签。

"Nokia Lumia" 和 "IPhone 5s" 等手机名称不应显示在图表中;仅在解释图例的底部需要它。

我在 Java 中的 and apache 的帮助下使用它。

我把BarChartDemo1改成了这样:

  • 显示图例。

    JFreeChart chart = ChartFactory.createPieChart(
        "Smart Phones Manufactured / Q3 2011",  // chart title
        dataset,            // data
        true,               // legend <<<<<<<<<<
        true,               // tooltips
        false               // no URL generation
    );
    
  • 不显示标签。

    // customise the section label appearance
    // plot.setLabelFont(new Font("Courier New", Font.BOLD, 20));
    // plot.setLabelLinkPaint(Color.WHITE);
    // plot.setLabelLinkStroke(new BasicStroke(2.0f));
    // plot.setLabelOutlineStroke(null);
    // plot.setLabelPaint(Color.WHITE);
    // plot.setLabelBackgroundPaint(null);
    plot.setLabelGenerator(null);