Hello,I am trying to use Fusion Free Charts with jsp. When i run my code below from browser i am getting the following error as its asking for CreateChart method -
Pls help resolve this error. What is there create chart method and how can i find it ?
ERROR :
************************************************************
An error occurred at line: 87 in the jsp file: /FusionCharts/MyChart/fusion.jsp
The method createChart(String, String, String, String, int, int, boolean, boolean) is undefined for the type fusion_jsp
84: }
************************************************************
Code is below
************************************************************
<jsp:useBean id="dbconn" class = "dbcon.ConnectionUtil" scope="page"/>
<%@ page import="java.sql.Statement"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.sql.ResultSet"%>
<%@ page import="java.sql.Date"%>
<HTML>
<HEAD>
<TITLE>FusionCharts - Database Example</TITLE>
<SCRIPT LANGUAGE="Javascript" SRC="FusionCharts.js"></SCRIPT>
</HEAD>
<BODY>
<%
/*
In this example, we show how to connect FusionCharts to a database.
For the sake of ease, we've used a database which contains two tables,
which are linked to each other.
*/
Connection conn;
conn = dbconn.getConnection();
//Database Objects - Initialization
Statement st1,st2;
ResultSet rs1,rs2;
String strQuery="";
//strXML will be used to store the entire XML document generated
String strXML="";
//Generate the chart element
strXML = "<chart caption='Factory Output report' subCaption='By Quantity pieSliceDepth='30' showBorder='1' formatNumberScale='0' numberSuffix='Units'>";
//Construct the query to retrieve data
strQuery = "select * from sarlogs";
st1=conn.createStatement();
rs1=st1.executeQuery(strQuery);
String factoryvalue= null;
String factoryId=null;
String factoryName=null;
String totalOutput="";
//Iterate through each factory
while(rs1.next()) {
factoryId=rs1.getString("timestamp");
factoryvalue=rs1.getString("value");
factoryName="SERVER1";
//Now create second recordset to get details for this factory
//Generate <set label='..' value='..'/>
strXML += "<set label='" + factoryName + "' value='" +factoryvalue+ "'/>";
//Close resultset
} //end of while
//Finally, close <chart> element
strXML += "</chart>";
//close the resulset,statement,connection
try {
if(null!=rs1){
rs1.close();
rs1=null;
}
}catch(java.sql.SQLException e){
System.out.println("Could not close the resultset");
}
try {
if(null!=st1) {
st1.close();
st1=null;
}
}catch(java.sql.SQLException e){
System.out.println("Could not close the statement");
}
try {
if(null!=conn) {
conn.close();
conn=null;
}
}catch(java.sql.SQLException e){
System.out.println("Could not close the connection");
}
//Create the chart - Pie 3D Chart with data from strXML
String chartCode=createChart("../../FusionCharts/line.swf", "", strXML,
"FactorySum", 600, 300, false, false);
%>
<%=chartCode%>
</BODY>
</HTML>
************************************************************