IDForums Report post Posted April 29, 2009 Need help in refreshing Fusion Charts from Mysql database which gets updated every 10 min. How do I update my charts in Dashboard in JSP? Share this post Link to post Share on other sites
FusionCharts Support Report post Posted April 30, 2009 Hi, We have some real time charts in FusioWidgets that you can use to update data from server after certain intervals. In case you wish to use charts from FusionCharts pack, you would need to use JavaScript window.setInterval/window.setTimeout to call a JavaScript function which would update the chart using chart's setDataURL/setDataXML API. The update is bwtter one using setDataURL API as using this you can call a server side script which would build the XML from the database and provide the latest XML. Please note that you would need to apply cache kill mechanism to the URL as there might be some browsers where the data keeps the XML cached. Share this post Link to post Share on other sites
IDForums Report post Posted April 30, 2009 Thanks for your reply Sudip. I have a copy which is given to me. FusionCharts_IS2_Dvlpr.zip Is this same as FusionWidgets? If not, could you please explain in detail about the JavaScript function by giving me an example? Share this post Link to post Share on other sites
IDForums Report post Posted April 30, 2009 (edited) I was unable to post my code with the html tags. I edited the tags to make them visible on the page. I hope its legible. Please suggest where and how do I have to include Javascript function to refresh my chart. Here is my code: index.jsp ________ <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> html head script language = "Javascript" src = "Files/FusionCharts.js" /script /head body <% String strDataURL=""; strDataURL = "BulbChart.jsp"; %> jsp:include page="Files/FusionChartsRenderer.jsp" flush="true" jsp:param name="chartSWF" value="Charts/FI2_RT_Bulb.swf" jsp:param name="strURL" value="<%=strDataURL%>" jsp:param name="strXML" value="" jsp:param name="chartId" value="Bulb" jsp:param name="chartWidth" value="150" jsp:param name="chartHeight" value="150" jsp:param name="debugMode" value="false" jsp:param name="registerWithJS" value="true" /jsp:include /body /html BulbChart.jsp ______________ <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ page import="java.sql.Statement" %> <%@ page import="java.sql.ResultSet" %> <%@ include file="Files/DBConn.jsp" %> <% //Database objects initialization Statement st1, st2 = null; ResultSet rs1, rs2 = null; String strQuery = null; //used to store entire XML Document generated String strXML = ""; strXML = ""; strXML += ""; strXML += ""; strXML += ""; strXML += ""; strXML += ""; strQuery = "select * from test order"; //Create the statement st1=oConn.createStatement(); //Execute the query rs1=st1.executeQuery(strQuery); String percent=null; while(rs1.next()) { percent=rs1.getString("percent"); } strXML += "" +percent+ ""; strXML += ""; try { if(rs1 != null){ rs1.close(); rs1=null; } }catch(java.sql.SQLException e){ //do something System.out.println("Could not close the resultset"); } try { if(st1 != null) { st1.close(); st1=null; } }catch(java.sql.SQLException e){ System.out.println("Could not close the statement"); } try { if(oConn != null) { oConn.close(); oConn=null; } }catch(java.sql.SQLException e){ System.out.println("Could not close the connection"); } //Set Proper output content-type response.setContentType("text/xml"); %> <%=strXML%> Edited April 30, 2009 by Guest Share this post Link to post Share on other sites
FusionCharts Support Report post Posted May 4, 2009 Hi, FusionWidgets is an upgrade to IS with a bunch of new features. Share this post Link to post Share on other sites