Hi all,
I have a GUI where I am displaying JFreeCharts in a JPanel. This works fine for a pie chart, but I can't get it to work for a time series chart which is what I really need. Here is my code from the JFreeChart class:
PHP Code:
public JFreeChart advancedTimeSeriesGraph() {
TimeSeries series = new TimeSeries("Time Series");
series.add(new Month(2, 2001), 200.0);
series.add(new Month(3, 2001), 167.3);
series.add(new Month(4, 2001), 153.8);
series.add(new Month(5, 2001), 167.6);
TimeSeriesCollection dataset = new TimeSeriesCollection();
dataset.addSeries(series);
JFreeChart chart = ChartFactory.createTimeSeriesChart("Time Series", dataset, true, true, true);
return chart;
}
...and the GUI class:
PHP Code:
private void AdvancedMouseClicked(java.awt.event.MouseEvent evt) {
DrawXYLineGraph chart1 = new DrawXYLineGraph();
JFreeChart chart = chart1.advancedTimeSeriesGraph();
ChartPanel chartPanel = new ChartPanel( chart );
GraphBox.add(chartPanel);
setVisible(true);
}
When I try to run I get the following output:
PHP Code:
Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: Uncompilable source code - incompatible types
found : org.jfree.chart.ChartFactory.createTimeSeriesChart
required: org.jfree.chart.JFreeChart
What am I doing wrong??
Any help on this would be really appreciated