2013-02-20 57 views
1

我想出了我最後的滯後情節,它看起來像這樣:添加傳說的JFreeChart

enter image description here

我先前的職位: Plotting a hysteresis loop with jFreeChart

我已經使用了4個XYSeries我的第一個滯後循環,另外四個用於第二個滯後循環。

如果我打開傳說

JFreeChart chart = ChartFactory.createXYLineChart(
"Hysteresis Plot", // chart title 
"Pounds(lb)", // domain axis label 
"Movement(inch)", // range axis label 
dataset, // data 
PlotOrientation.VERTICAL, // orientation 
true, // include legend 
true, // tooltips 
false // urls 
); 

看起來是這樣的:

enter image description here

我只是想表明,藍色是我第一次磁滯回線和紅色是我的第二磁滯回線,作爲解決方法,我在第一張圖片中添加了字幕。有人可以指導我如何添加指示藍色爲第一個循環和紅色爲第二個的手動圖例。

感謝

回答

1

因爲ChartFactory.createXYLineChart()創建XYPlot,你可以嘗試setFixedLegendItems(),提到herehere

一個更加雄心勃勃的方案是抑制本地圖例並在獨立組件中渲染圖例項目,如here所示。