Prashant Shinde

Issue - Error In Loading Data While Using Strxml In Jsp

Recommended Posts

hello friends,

 

Im using FusionCharts v3.2.1 (Evaluation Version).

 

While trying to use the strXML method to display charts I face "Error in loading data" issue, but when I use the strDataUrl i.e the XML file method I can see

all the charts successfully without any problem.

 

******** Here my code snippet starts ************

 

 

<%@ taglib prefix="s" uri="/struts-tags"%>

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

<head>

<title>Welcome!</title>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<script LANGUAGE="Javascript" SRC="/jsp/charts/FusionCharts/FusionCharts.js"></SCRIPT>

</head>

<s:form action="" method="post" id="sysForm" name="form" theme="simple">

<table>

<tr>

<td width="100%">

<%

String strXML;

strXML = "<chart caption='Monthly Unit Sales' xAxisName='Month' yAxisName='Units' showValues='0' formatNumberScale='0' showBorder='1'> ";

strXML += "<set label='Jan' value='462' /><set label='Feb' value='857' /><set label='Mar' value='671' /> <set label='Apr' value='494' /><set label='May' value='761' /><set label='Jun' value='960' /> <set label='Jul' value='629' /><set label='Aug' value='622' /><set label='Sep' value='376' /> <set label='Oct' value='494' /><set label='Nov' value='761' /><set label='Dec' value='960' />";

strXML +="</chart>";

 

//strXML = "<graph caption='Monthly Unit Sales' xAxisName='Month' yAxisName='Units' showValues='0' formatNumberScale='0' showBorder='1'> ";

//strXML += "<set name='Jan' value='462' /><set name='Feb' value='857' /><set name='Mar' value='671' /> <set name='Apr' value='494' /><set name='May' value='761' /><set name='Jun' value='960' /> <set name='Jul' value='629' /><set name='Aug' value='622' /><set name='Sep' value='376' /> <set name='Oct' value='494' /><set name='Nov' value='761' /><set name='Dec' value='960' />";

//strXML += "</graph>";

//Create the chart - Column 3D Chart with data contained in strXML

String chartCode = createChartHTML(

"../jsp/charts/FusionCharts/Column3D.swf", "", strXML,

"productSales", 600, 300, false);

%> <%=chartCode%></td>

</tr>

</table>

</s:form>

 

******** Here my code snippet ends ************

 

--------- Object printed using sop in FusionCharts.jsp----------

 

 

<!--START Code Block for Chart-->

<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='600' height='300' id='productSales'>

<param name='allowScriptAccess' value='always' />

<param name='movie' value='../jsp/charts/FusionCharts/Column3D.swf'/>

<param name='FlashVars' value="chartWidth=600&chartHeight=300&debugMode=0&dataStr=<chart caption='Monthly Unit Sales' xAxisName='Month' yAxisName='Units' showValues='0' formatNumberScale='0' showBorder='1'> <set label='Jan' value='462' /><set label='Feb' value='857' /><set label='Mar' value='671' /> <set label='Apr' value='494' /><set label='May' value='761' /><set label='Jun' value='960' /> <set label='Jul' value='629' /><set label='Aug' value='622' /><set label='Sep' value='376' /> <set label='Oct' value='494' /><set label='Nov' value='761' /><set label='Dec' value='960' /></chart>" />

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

<embed src='../jsp/charts/FusionCharts/Column3D.swf' FlashVars="chartWidth=600&chartHeight=300&debugMode=0&dataStr=<chart caption='Monthly Unit Sales' xAxisName='Month' yAxisName='Units' showValues='0' formatNumberScale='0' showBorder='1'> <set label='Jan' value='462' /><set label='Feb' value='857' /><set label='Mar' value='671' /> <set label='Apr' value='494' /><set label='May' value='761' /><set label='Jun' value='960' /> <set label='Jul' value='629' /><set label='Aug' value='622' /><set label='Sep' value='376' /> <set label='Oct' value='494' /><set label='Nov' value='761' /><set label='Dec' value='960' /></chart>" quality='high' width='600' height='300' name='productSales' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />

</object>

<!--END Code Block for Chart-->

 

----------------------------X--------------------

 

I need help resolving this issue & use the strXML method, Iv tried everything I could just dont know what Im doing wrong, any help regarding the same will be appreciated.

 

regards

Prashant

Edited by Prashant Shinde

Share this post


Link to post
Share on other sites

Hi Prashant

 

I am looking into this problem. While I am at it, can you please try out the new jsp tag library which would be present along with your evaluation download.

 

The way to use the FusionCharts jsp tag library is simple. Here is a code snippet:

<fc:render chartId="myFirstChart" swfFilename="../../FusionCharts/Column3D.swf"     width="300" height="200" debugMode="false"  registerWithJS="false" xmlUrl="Data/Data.xml" />

 

 

Here is the documentation page showing the usage: http://www.fusioncharts.com/docs/Code/J2EE/JSP_BasicExample.html

 

Please try it out and let me know.

Share this post


Link to post
Share on other sites

Hi Prashant,

 

On further investigation, I realized that there are a few modifications required in your code to get it to work.

 

Here is a simple code snippet which works with the latest download:

 

<%@page import="com.fusioncharts.FusionChartsHelper"%>
<html>
<body>
<%--  
   chartId="myFirst"
   swfFilename = "../../FusionCharts/Column3D.swf"
width="600"
height="300"
debugMode="false"
--%>		
<%
String strXML;
strXML = "<chart caption='Monthly Unit Sales' xAxisName='Month' yAxisName='Units' showValues='0' formatNumberScale='0' showBorder='1'> ";
strXML += "<set label='Jan' value='462' /><set label='Feb' value='857' /><set label='Mar' value='671' /> <set label='Apr' value='494' /><set label='May' value='761' /><set label='Jun' value='960' /> <set label='Jul' value='629' /><set label='Aug' value='622' /><set label='Sep' value='376' /> <set label='Oct' value='494' /><set label='Nov' value='761' /><set label='Dec' value='960' />";
strXML +="</chart>";




//Create the chart - Column 3D Chart with data contained in strXML
String chartCode = FusionChartsHelper.createChartHTML("../../FusionCharts/Column3D.swf", "", strXML,
"productSales", "600", "300", false);
%> <%=chartCode%>

</body>
</html>

 

Hope this works for you too.

 

regards,

Srividya Sharma

Share this post


Link to post
Share on other sites

hi Srividya Sharma,

 

This worked perfectly for me, I appreciate the time & effort invested by you in helping me out.

 

 

Thank you very much for the help !!!!

 

 

have a nice time !!!

 

regards

Prashant

Edited by Prashant Shinde

Share this post


Link to post
Share on other sites
Guest Angie

Hi Prashant,

 

Thank you very much for your appreciation.

 

We are glad to know that you have managed to solve your problem.

 

Keep Smiling and keep FusionCharting!biggrin.gif

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