JSP and CreateChart method
FusionCharts Forum
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



JSP and CreateChart method Expand / Collapse
Author
Message
Posted 4/16/2008 1:57:31 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 4/17/2008 12:37:53 AM
Posts: 3, Visits: 3
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>


************************************************************

Post #5677
Posted 4/16/2008 8:38:52 AM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Moderators
Last Login: 2 days ago @ 4:56:35 AM
Posts: 706, Visits: 1,143
Hi,

Could you please try including the FusionCharts.jsp in your application?

e.g. <%@ include file="Includes/FusionCharts.jsp"%>


Regards,

Sudipto Choudhury
FusionCharts Team

Post #5693
Posted 4/17/2008 12:54:46 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 4/17/2008 12:37:53 AM
Posts: 3, Visits: 3
Hi Sudipto,

Where is this FusionCharts.jsp ? I am not able to find it in the zip file i downloaded for fusion charts free.

Regards,

Sachin

Post #5716
Posted 4/17/2008 8:56:47 AM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Moderators
Last Login: 2 days ago @ 4:56:35 AM
Posts: 706, Visits: 1,143
Hi,

Could you please download the eval version of FusionCharts v3 in which you would get the file needed.

Moreover, please note that you are using the XML for FusionCharts v3 and not for FusionCharts FREE. Please change the <chart>/</chart> to <graph> </graph> and 'label' to 'name' so that the XML works for FREE charts.

Please visit documentation for FREE in www.fusioncharts.com/free/docs for more on the XML structure of FREE charts.

Regards,

Sudipto Choudhury
FusionCharts Team

Post #5739
« Prev Topic | Next Topic »


Permissions Expand / Collapse

All times are GMT -7:00, Time now is 6:12am


Execution: 0.063.