0
我需要的代碼,這將有助於我創建一個類似於像http://www.jidesoft.com/images/line-chart-gradient-fill.png中所示的圖表也應該是一個時間序列圖Jfree圖表版本梯度基德軟線圖的填
我需要的代碼,這將有助於我創建一個類似於像http://www.jidesoft.com/images/line-chart-gradient-fill.png中所示的圖表也應該是一個時間序列圖Jfree圖表版本梯度基德軟線圖的填
第一我想推薦購買JFreeChart開發者指南。它包含了一大套很好的例子,它支持這個項目的維護者。
關於你的問題:我不知道你的主要目標是什麼。
一個好的起點是提供JFreeChart源的類TimeSeriesChartDemo1
。
private static JFreeChart createChart(XYDataset dataset) {
JFreeChart chart = ChartFactory.createTimeSeriesChart(
"Legal & General Unit Trust Prices", // title
"Date", // x-axis label
"Price Per Unit", // y-axis label
dataset, // data
true, // create legend?
true, // generate tooltips?
false // generate URLs?
);
chart.setBackgroundPaint(Color.white);
XYPlot plot = (XYPlot) chart.getPlot();
plot.setBackgroundPaint(Color.lightGray);
plot.setDomainGridlinePaint(Color.white);
plot.setRangeGridlinePaint(Color.white);
plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
plot.setDomainCrosshairVisible(true);
plot.setRangeCrosshairVisible(true);
XYItemRenderer r = new XYAreaRenderer2();
r.setSeriesPaint(0, new Color(255, 0, 0, 50));
r.setSeriesPaint(0, new Color(0, 255, 0, 50));
plot.setRenderer(r);
DateAxis axis = (DateAxis) plot.getDomainAxis();
axis.setDateFormatOverride(new SimpleDateFormat("MMM-yyyy"));
return chart;
}
是否回答你的問題:
通過設置不同的渲染器修改此演示的
createChart
方法?在這種情況下,請將您的問題標記爲已解決。謝謝! – Uli 2015-02-04 08:44:09