Java jfree图表-如何向不在数据源中的图例添加新项
我正在尝试在图例中添加新项目或标签,此项目在数据集中不可用。应使用哪种方法将此项目添加到图例?来自: 在条形图上添加自定义颜色的图例:Java jfree图表-如何向不在数据源中的图例添加新项,java,jfreechart,Java,Jfreechart,我正在尝试在图例中添加新项目或标签,此项目在数据集中不可用。应使用哪种方法将此项目添加到图例?来自: 在条形图上添加自定义颜色的图例: LegendItemCollection chartLegend = new LegendItemCollection(); Shape shape = new Rectangle(10, 10); chartLegend.add(new LegendItem("label1", null, null, null, shape, Color.red)); cha
LegendItemCollection chartLegend = new LegendItemCollection();
Shape shape = new Rectangle(10, 10);
chartLegend.add(new LegendItem("label1", null, null, null, shape, Color.red));
chartLegend.add(new LegendItem("label2", null, null, null, shape, Color.blue));
plot.setFixedLegendItems(chartLegend);