簡體   English   中英

jfree圖表 - 如何將新項目添加到不在數據源中的圖例

[英]jfree chart - how to add new item to legend that is not in data source

我正在嘗試在圖例中添加新項目或標簽,此項目在數據集中不可用。 應該使用哪種方法將此項添加到圖例?

來自jfree論壇

在條形圖上添加自定義顏色的圖例:

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);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM