Sign in to follow this  
FusionCharts Support

Chart is not displaying

Recommended Posts

Hi!!!

I've downloaded fusion charts software and tried to run in IE. But am not able to see the output. Am using Netbeans 5.5. I've checked everything. am able to get the data from backend to jsp but am not able to view the chart.  in the browser am getting some layout and when i click on it, it is also disappearing. here am attaching my code. can anyone give me a solution for this?

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

<%@ page import="com.sajix.helix.actions.BaseApplicationAction, java.sql.*"%>

<%@ page import="java.sql.Statement"%>

<%@ page import="java.sql.ResultSet"%>

<%@ page import="java.sql.Date"%>

<HTML

<HEAD>

<TITLE>FusionCharts - Database Example</TITLE>

<SCRIPT LANGUAGE="Javascript" SRC="/FusionCharts/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.

*/

 

//Database Objects - Initialization

Statement st1,st2;

ResultSet rs1,rs2;

Connection con=BaseApplicationAction.dbConnection();

 

String strQuery="";

 

//strXML will be used to store the entire XML document generated

String strXML="";

 

 

//Generate the chart element

strXML = "<chart caption='Surgery report' subCaption='Yearly' width='900' height='300' id='Column3D'>";

 

//Construct the query to retrieve data

strQuery = "select month(surdate),count(*) from sjx_hms_sgy where year(surdate)='2007' group by month(surdate)";

System.out.println(strQuery);

 

st1=con.createStatement();

rs1=st1.executeQuery(strQuery);

 

String surgeryid=null;

String noofsurgeries=null;

String totalOutput="";

//Iterate through each factory  

while(rs1.next()) {

System.out.println("inside while loop");

surgeryid=rs1.getString(1);

noofsurgeries=rs1.getString(2);

//Now create second recordset to get details for this factory

 

//Generate <set label='..' value='..'/>  

strXML += "<set label='" + surgeryid + "' value='" +noofsurgeries+ "'/>";

System.out.println(strXML);

//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!=con) {

con.close();

con=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=createChartHTML("./FusionCharts/Column2D.swf", strXML, "" , "Surgery", 600, 300, false);

 

%>

<%=chartCode%>

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="900" height="300" id="Column2D" >

<param name="movie" value="/FusionCharts/Column2D.swf" />

<param name="FlashVars" value="&dataURL=Data.xml">

<param name="quality" value="high" />

<embed src="/FusionCharts/Column2D.swf" flashVars="&dataURL=Data.xml" quality="high" width="900" height="300" name="Column3D" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />

  </object>

</BODY>

</HTML>

Share this post


Link to post
Share on other sites

hi,

As i go through your code i feel to focus on some pointers below :

1. Please verify the path of the chart SWF files used given in createChartHTML method and in the <object> tag... though i personally feel that defining the chart again with  <object>  is unnecessary as you are already creating it using createChartHTML.

2. in the method createChartHTML please specify the strXML in the next parameter...i.e.

createChartHTML("./FusionCharts/Column2D.swf","",strXML, "Surgery",600,300,false);

Syntax:

createChartHTML(String SWFnameWithPath, String dataURLPath(URLEncoded), String dataXML, String ChartId ,int width,int height,boolean debugMode);

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this