writeChartAsPNG cannot resolve symbol

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
goutam

writeChartAsPNG cannot resolve symbol

Post by goutam » Wed Feb 26, 2003 11:49 pm

Hello !
I did write a jsp page to display an image. I did include all the files and all classes exist . (For eg. ChartUtilities.class exist and is at the right place.
However it displays me an error.

cannot resolve symbol
symbol : method writeChartAsPNG (javax.servlet.jsp.JspWriter,com.jrefinery.chart.JFreeChart,int,int)
location: class com.jrefinery.chart.ChartUtilities
ChartUtilities.writeChartAsPNG(out,jf,400,300);
I am using the lates library jfreechart-0.9.6 and also do have documentation.

thanks,
goutam




<%@page import="com.jrefinery.chart.*"%>
<%@page import="com.jrefinery.data.*"%>


<%@page contentType="image/jpg"%>
<%

try {
DefaultPieDataset dataset= new DefaultPieDataset();
dataset.setValue("Category 1",43);
dataset.setValue("Category 2",27);
dataset.setValue("Category 3",79);
JFreeChart jf = ChartFactory.createPieChart("Sample Pie Chart",dataset,true,true,false);
ChartUtilities.writeChartAsPNG(out,jf,400,300);
}
catch (Exception e) {
//out.println(e.toString());
}

%>

Helper

Re: writeChartAsPNG cannot resolve symbol

Post by Helper » Thu Feb 27, 2003 4:06 pm

Hello,

From the java doc.:

java.lang.Object
|
+--java.io.Writer
|
+--javax.servlet.jsp.JspWriter


java.lang.Object
|
+--java.io.OutputStream

Method signature is

writeChartAsPNG (java.io.OutputStream,com.jrefinery.chart.JFreeChart,int,int)

and NOT

writeChartAsPNG (javax.servlet.jsp.JspWriter,com.jrefinery.chart.JFreeChart,int,int)

So the version of the method you used doesn't exist because of the wrong parameter type.

Hope this helps.

Locked