Sign in to follow this  
srividya_sharma

Notable to create the chart with FusionChartsCreator class

Recommended Posts

Hi,

I have written the code in my jsp to create the chart using FusionChartsCreator

but the chart is not displaying instead ut is generating only string Chart.

With the same xml file using FusionChartsHTMLRenderer, but i want to use the first method as i need to pass the parameters dynamically from DB

here is my code:

<td width="60%" >

<% String chartCode=FusionChartsCreator.createChart("..//FusionCharts/Pie3D.swf", "..//Data/FirstChartData.xml","" , dbUnitName, 450, 300, false, false);%>

 <%=chartCode%></td>

 and :

<td width="60%">

  <jsp:include page="FusionChartsHTMLRenderer.jsp" flush="true">

  <jsp:param name="chartSWF" value="..//FusionCharts/Pie3D.swf" />

  <jsp:param name="strURL" value="..//Data/FirstChartData.xml" />

  <jsp:param name="strXML" value="" />

  <jsp:param name="chartId" value="chart1" />

  <jsp:param name="chartWidth" value="450" />

  <jsp:param name="chartHeight" value="300" />

  <jsp:param name="debugMode" value="false" />

  <jsp:param name="registerWithJS" value="true" />

  </jsp:include>

  <BR>

  <BR>

  </td>

Please help for the same, its urgent

Thanks,

rama

Share this post


Link to post
Share on other sites

Can you post the code that you see in View Source of the generated html page?

Also, the second method can be used in any scenario. Can you tell me exactly why you want to use the first method?

Edited by Guest

Share this post


Link to post
Share on other sites

Hi,

I am getting the chart parameters from Database , which i want to use to create the chart I can't use jsp:param as it will not allow the java code inside:

my Clob data is like "chartWidth=500;chartHeight=400;.."

so please suggest me if you have any other way to do this.

see the view source code:

<HTML><HEAD><TITLE>EisCharts - Simple Pie 3D Chart</TITLE><style type="text/css">.bg1{	background-color:#D2D7DF;}.bg2{	background-color:#F5F5DC;}</style><link href="/OA_HTML/eisrs/jsp/js/sortabletable.css" rel="stylesheet" type="text/css"><script type="text/javascript" src="/OA_HTML/eisrs/jsp/js/string_functions.js"></script>
<link rel="stylesheet" charset="UTF-8" type="text/css" href="/OA_HTML/eisrs/jsp/js/eis-desktop-custom-windows.css"><SCRIPT LANGUAGE="Javascript" SRC="../../FusionCharts/FusionCharts.js"></SCRIPT><SCRIPT LANGUAGE="JavaScript">               function drillDownJS(ethnicOrigin){            window.open("/OA_HTML/eisrs/jsp/dashBoard/EisDBEmployeesDetails.jsp?ethnic_origin=" + ethnicOrigin,'',"title=no,status=yes,location=yes,toolbar=no,directories=no,resizable=yes,width=750,height=420,top=150,left=120,scrollbars=yes");         }          function drillDownJS3(addrState){            window.open("/OA_HTML/eisrs/jsp/dashBoard/EisDBNewHireDrillDown.jsp?addr_state=" + addrState,'',"title=no,status=yes,location=yes,toolbar=no,directories=no,resizable=yes,width=750,height=420,top=150,left=120,scrollbars=yes");         }         function drillDownJS2(year,leavingReason){         alert(year);         alert(leavingReason);            window.open("/OA_HTML/eisrs/jsp/dashBoard/EisDBEmployeesDetails.jsp?year=" + year+"&leaving_reason=" +leavingReason,'',"title=no,status=yes,location=yes,toolbar=no,directories=no,resizable=yes,width=750,height=420,top=150,left=120,scrollbars=yes");         }      </SCRIPT></HEAD><BODY><form name="frm" method="post" action="EisDBEmployeesDetails.jsp"><CENTER> <h2>XXEIS HR Dashboard</h2>    <table>            <tr>
        <td width="50%" >      			<!-- START Script Block for Chart-->		<div id='Turnover ComparisonDiv' align='center'>				Chart.		</div>		<script type='text/javascript'>				var chart_Turnover Comparison = new FusionCharts('/OA_HTML/eisrs/jsp/dashboard/FC/Pie3D.swf', 'Turnover Comparison', '450', '300', '0', '0');				// Set the dataURL of the chart				chart_Turnover Comparison.setDataURL("/OA_HTML/eisrs/jsp/dashboard/Data/FirstChartData.xml");				// Finally, render the chart.				chart_Turnover Comparison.render("Turnover ComparisonDiv");		</script>		<!--END Script Block for Chart-->          <BR>
          <BR>          </td>          <td width="50%">             			<!--START Code Block for Chart chart2 -->			<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="450" height="300" id="chart2">			<param name="allowScriptAccess" value="always" />			<param name="movie" value="/OA_HTML/eisrs/jsp/dashboard/FC/MSColumn3D.swf"/>			<param name="FlashVars" value="chartWidth=450&chartHeight=300&debugMode=0&dataURL=/OA_HTML/eisrs/jsp/dashboard/XMLData/SecondChartData.xml" />
			<param name="quality" value="high" />			<embed src="/OA_HTML/eisrs/jsp/dashboard/FC/MSColumn3D.swf" FlashVars="chartWidth=450&chartHeight=300&debugMode=0&dataURL=/OA_HTML/eisrs/jsp/dashboard/XMLData/SecondChartData.xml" 			quality="high" width="450" 			height="300" name="chart2"			allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />			</object>			<!--END Code Block for Chart chart2 -->            <BR>            <BR>            </td>          </tr>
          </table>                              <a href='NoChart.html' target="_blank">Unable to see the chart        above?</a></CENTER></form></BODY></HTML>

Share this post


Link to post
Share on other sites

Hi Ramadevi,

As far I can see, you can use both methods in this situation also. Inside jsp:param you would use

value="<%=myChartWidth%>"

I think the problem lies in "Turnover Comparison" which is given as chartId. ChartId cannot have spaces in it. ( it will be later appended to "chart_" to create a javascript variable.)

Please specify the chartId without any spaces. Hope that works out! :)

Edited by Guest

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