Quantcast
Channel: iT邦幫忙
Viewing all articles
Browse latest Browse all 15645

請問jfreechart如何繪出虛線?

$
0
0
請問jfreechart如何繪出虛線?

我使用
jcommon-1.0.17.jar
jfreechart-1.0.14.jar
函式庫。

XYSeries xyseries1 = new XYSeries("One");
xyseries1.add(1987, 50);
xyseries1.add(1997, 20);
xyseries1.add(2007, 30);
就是想讓此處的實線變成虛線。
實際的數據,會比此例多甚多。

XYSeriesCollection xySeriesCollection = new XYSeriesCollection();
xySeriesCollection.addSeries(xyseries1);

JFreeChart XYChart = ChartFactory.createXYLineChart
("XYLine Chart using JFreeChart", "Age", "Weight",
xySeriesCollection, PlotOrientation.VERTICAL, true, true, false);

XYChart.setBackgroundPaint(Color.white);
XYPlot xyplot = (XYPlot)XYChart.getPlot(); //獲得 plot:XYPlot!!
xyplot.setBackgroundPaint(Color.lightGray); //設定圖表數據顯示部分背景色
xyplot.setDomainGridlinePaint(Color.red); //網格線顏色
xyplot.setRangeGridlinePaint(Color.red);

雖然,想從上述類別著手,但不知如何設定?

謝謝您的解答!

Viewing all articles
Browse latest Browse all 15645

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>