Hi,
I'm having trouble compiling a bit of code. I want to generate a time series chart from some a JDBCXYDataset. The code is below:
JDBCXYDataset lineDataSet = null;
Connection con;
try {
con = DBDaemon.getConnection(sPool);
lineDataSet = new JDBCXYDataset(con);
lineDataSet.executeQuery(sQuery);
con.close();
}
catch (SQLException e) {
System.err.print("SQLException: ");
System.err.println(e.getMessage());
throw new RuntimeException(e.getMessage());
}
catch (Exception e) {
System.err.print("Exception: ");
System.err.println(e.getMessage());
throw new RuntimeException(e.getMessage());
}
chart = ChartFactory.createTimeSeriesChart
(sTitle, // Title
sDomainLabel, // Domain access label
sRangeLabel, // Range access label
lineDataSet, // Dataset
PlotOrientation.VERTICAL, // Plot Orientation
true, //legend
true, // tooltips
false
);
and this is the compile error I get:
JDBCLineChartServlet.java:84: createTimeSeriesChart(java.lang.String,java.lang.String,java.lang.String,org.jfree.data.xy.XYDataset,boolean,boolean,boolean) in org.jfree.chart.ChartFactory cannot be applied to (java.lang.String,java.lang.String,java.lang.String,org.jfree.data.jdbc.JDBCXYDataset,org.jfree.chart.plot.PlotOrientation,boolean,boolean,boolean)
chart = ChartFactory.createTimeSeriesChart
What to do?
How to generate time series chart from JDBC data?
-
- Posts: 3
- Joined: Wed Nov 03, 2004 8:28 pm
Hi,
I did not try out your code. I think it shoud work with explicit casting your
lineDataSet into XYDataset
[...]
chart = ChartFactory.createTimeSeriesChart
(sTitle, // Title
sDomainLabel, // Domain access label
sRangeLabel, // Range access label
(XYDataset) lineDataSet, // Dataset
PlotOrientation.VERTICAL, // Plot Orientation
true, //legend
true, // tooltips
false);
I did not try out your code. I think it shoud work with explicit casting your
lineDataSet into XYDataset
[...]
chart = ChartFactory.createTimeSeriesChart
(sTitle, // Title
sDomainLabel, // Domain access label
sRangeLabel, // Range access label
(XYDataset) lineDataSet, // Dataset
PlotOrientation.VERTICAL, // Plot Orientation
true, //legend
true, // tooltips
false);