我正在使用JFreeChart繪製多個TimeSeries圖表。它似乎工作正常,但截至今日,所有圖表似乎閃爍,並隨機擾動,使他們無法看到。如果我最小化和最大化,則問題會在幾秒內得到修復,直到下次更新或鼠標單擊。有人對這個問題有什麼想法嗎?使用JFreeChart進行毛刺圖形繪製
的代碼非常簡單:
TimeSeries ts = new TimeSeries("Graph", Millisecond.class);
TimeSeriesCollection dataset = new TimeSeriesCollection(ts);
JFreeChart Graph = createChart(dataset);
ChartPanel panel_Graph = new ChartPanel(Graph);
....
JFrame newWindow = new JFrame("Graph");
newWindow.setLayout(new GridLayout());
newWindow.setContentPane(panel_Graph);
newWindow.setMinimumSize(new Dimension(600, 480));
newWindow.setLocationRelativeTo(null);
newWindow.setVisible(true);
static private JFreeChart createChart(TimeSeriesCollection dataset) {
JFreeChart chart = ChartFactory.createTimeSeriesChart(
"Graph",
"Time",
"Value",
dataset,
false,
true,
false
);
final XYPlot plot = chart.getXYPlot();
ValueAxis timeaxis = plot.getDomainAxis();
timeaxis.setAutoRange(true);
timeaxis.setFixedAutoRange(60000.0);
return chart;
}
爲什麼你將XYPlot標記爲最終? – Koekiebox 2009-10-13 13:22:31
嗯,這只是嘗試在互聯網上嘗試解決問題的不同解決方案所剩餘的。刪除它沒有區別。 – thodinc 2009-10-13 13:54:05