﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>FusionCharts Forum / FusionCharts Free / JavaScript Problems   / setDataURL() example in docs not working / Latest Posts</title><generator>InstantForum.NET v4.1.4</generator><description>FusionCharts Forum</description><link>http://www.fusioncharts.com/forum/</link><webMaster>support@fusioncharts.com</webMaster><lastBuildDate>Mon, 08 Sep 2008 07:19:42 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: setDataURL() example in docs not working</title><link>http://www.fusioncharts.com/forum/Topic1675-47-1.aspx</link><description>Moreover, try using the latest FusionCharts.js released on 22 Dec wiht v3.0.5</description><pubDate>Thu, 10 Jan 2008 05:24:13 GMT</pubDate><dc:creator>Sudipto Choudhury</dc:creator></item><item><title>RE: setDataURL() example in docs not working</title><link>http://www.fusioncharts.com/forum/Topic1675-47-1.aspx</link><description>You need to use registerWithJS to get all functions like feedData()</description><pubDate>Thu, 10 Jan 2008 05:22:59 GMT</pubDate><dc:creator>Sudipto Choudhury</dc:creator></item><item><title>RE: setDataURL() example in docs not working</title><link>http://www.fusioncharts.com/forum/Topic1675-47-1.aspx</link><description>I still get the error message 'feedData() not a function'. I just ran the example at http://www.fusioncharts.com/gadgets/docs/ -&gt; feeding data using javascript.&lt;br&gt;&lt;br&gt;Mozilla is reporting that 'chartRef.feedData is not a function'.&lt;br&gt;&lt;br&gt;I think this feedData() function is still confusing many.&lt;br&gt;&lt;br&gt;As I used the example as such, there is no question of registering the object with '1' (the last argument in 'new FusionChart()'). Moreover I am running the script behind a server (Apache).&lt;br&gt;&lt;br&gt;Hope to get some useful clarification.&lt;br&gt;&lt;br&gt;Thanks in advance.</description><pubDate>Wed, 09 Jan 2008 11:23:30 GMT</pubDate><dc:creator>mgnanamani</dc:creator></item><item><title>RE: setDataURL() example in docs not working</title><link>http://www.fusioncharts.com/forum/Topic1675-47-1.aspx</link><description>When I ran into the problem, my web page did not have a &amp;lt;form&amp;gt; and I was already using the latest FusionCharts.js file--the one with this in the header:  "Version: 1.2 (1st November, 2007) - Added Player detection, New conditional fixes for IE, New FORM fixes for IE."&lt;/P&gt;&lt;P&gt;-Tim</description><pubDate>Wed, 09 Jan 2008 10:06:23 GMT</pubDate><dc:creator>timvasil</dc:creator></item><item><title>RE: setDataURL() example in docs not working</title><link>http://www.fusioncharts.com/forum/Topic1675-47-1.aspx</link><description>Hi,&lt;/P&gt;&lt;P&gt;Thanks for the valuable R&amp;amp;D.&lt;/P&gt;&lt;P&gt;Can you please try the new FusionCharts.js released with FusionCharts v3.0.5 where we try to cope up with the IE's external interface issue while using the chart inside a form.</description><pubDate>Sun, 06 Jan 2008 08:10:50 GMT</pubDate><dc:creator>Sudipto Choudhury</dc:creator></item><item><title>RE: setDataURL() example in docs not working</title><link>http://www.fusioncharts.com/forum/Topic1675-47-1.aspx</link><description>FusionCharts is using Adobe's &lt;A href="http://livedocs.adobe.com/flex/201/langref/flash/external/ExternalInterface.html#includeExamplesSummary"&gt;ExternalInterface API&lt;/A&gt; to communicate between JavaScript and the SWF chart. For some reason, ExternalInterface isn't working correctly on IE under some conditions.  I happen to be using the ExtJS library with GWT; either framework may be doing some DOM manipulations under the covers that are freaking out Adobe--but I haven't verified this.&lt;P&gt;A couple things to try:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Ensure that the ID and name attributes of the OBJECT and/or EMBED tags do not have characters such as . (period), -, +, *, /, and \.  Amusingly, this is because Adobe's ExternalInterface API is using a bunch of eval() JavaScript methods and these special characters get interpreted as JavaScript operators.  Yeah, great work, Adobe.&lt;BR&gt; &lt;/LI&gt;&lt;LI&gt;Hook up the ExternalInterface functions you need manually.  For example, here's the modified setDataXML function in FusionCharts.js to do the trick (code in red has been added):&lt;/LI&gt;&lt;/OL&gt;&lt;FONT size=2&gt;&lt;FONT size=2&gt;&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;&lt;P align=left&gt;setDataXML: function(strDataXML){&lt;BR&gt;    //If being set initially&lt;BR&gt;    if (this.initialDataSet==false){&lt;BR&gt;        //This method sets the data XML for the chart INITIALLY.&lt;BR&gt;        this.addVariable('dataXML',strDataXML);&lt;BR&gt;        //Update flag&lt;BR&gt;        this.initialDataSet = true;&lt;BR&gt;    }else{&lt;BR&gt;        //Else, we update the chart data using External Interface&lt;BR&gt;        //Get reference to chart object&lt;BR&gt;        var chartObj = infosoftglobal.FusionChartsUtil.getChartObject(this.getAttribute('id'));&lt;BR&gt;&lt;FONT color=#dd1111&gt;&lt;STRONG&gt;        if (!chartObj.setDataXML)&lt;BR&gt;        {&lt;BR&gt;            __flash__addCallback(chartObj, "setDataXML");&lt;BR&gt;        }&lt;BR&gt;&lt;/STRONG&gt;&lt;/FONT&gt;        chartObj.setDataXML(strDataXML);&lt;BR&gt;    }&lt;BR&gt;},&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P align=left&gt; &lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;</description><pubDate>Thu, 03 Jan 2008 01:41:13 GMT</pubDate><dc:creator>timvasil</dc:creator></item><item><title>RE: setDataURL() example in docs not working</title><link>http://www.fusioncharts.com/forum/Topic1675-47-1.aspx</link><description>&lt;DIV&gt;Hi all,&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;TO set RegisterWithJS :&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;This code is required in Javascript :&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;var chart1 = new FusionCharts("FusionCharts/Column3D.swf", "chart1Id", "400", "300", "0", "1");&lt;BR&gt;&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;while using ASP/PHP etc. -&lt;/DIV&gt;&lt;DIV&gt;&lt;BR&gt;[code]renderChart("/flash/Column2D.swf?ChartNoDataText=Please select a District to view detailed data.", "", "&amp;lt;chart&amp;gt;&amp;lt;/chart&amp;gt;", "FactoryDetailed", 300, 250, false, true)[/code]&lt;BR&gt;&lt;/DIV&gt;</description><pubDate>Sat, 10 Nov 2007 22:18:49 GMT</pubDate><dc:creator>Sudipto Choudhury</dc:creator></item><item><title>RE: setDataURL() example in docs not working</title><link>http://www.fusioncharts.com/forum/Topic1675-47-1.aspx</link><description>I encountered the "setDataURL is not a function" error as well.&lt;br&gt;&lt;br&gt;One of Pallav's previous posts mentioned:&lt;br&gt;&lt;br&gt;[quote]2. Please ensure that you've set registerWithJS flag to 1. For more information on how to do this, please see http://www.fusioncharts.com/Docs/Contents/JS_Overview.html. Basically, you need to set the last parameter in the following code to 1:&lt;br&gt;var chart1 = new FusionCharts("FusionCharts/Column3D.swf", "chart1Id", "400", "300", "0", "1");[/quote]&lt;br&gt;&lt;br&gt;In my controller that is responsible for contructing the chart I was using:&lt;br&gt;&lt;br&gt;[code]renderChart("/flash/Column2D.swf?ChartNoDataText=Please select a District to view detailed data.", "", "&lt;chart&gt;&lt;/chart&gt;", "FactoryDetailed", 300, 250, "0", "1")[/code]&lt;br&gt;&lt;br&gt;but I found that switching "0" to false and "1" to true will fix the error.&lt;br&gt;&lt;br&gt;Hope this helps.&lt;br&gt;&lt;br&gt;&lt;br&gt;--craan</description><pubDate>Fri, 09 Nov 2007 13:53:48 GMT</pubDate><dc:creator>lordcraan</dc:creator></item><item><title>RE: setDataURL() example in docs not working</title><link>http://www.fusioncharts.com/forum/Topic1675-47-1.aspx</link><description>I had the same problem with IE7, the problem was the name of the variable in the method updateChart.&lt;br&gt;&lt;br&gt;&lt;br&gt;[hr]&lt;br&gt;&lt;br&gt;My old code:&lt;br&gt;&lt;br&gt;[b]grafico1[/b]=false;&lt;br&gt;	&lt;br&gt;function FC_Rendered(DOMId){&lt;br&gt;&lt;br&gt;	switch(DOMId){&lt;br&gt;		case "[b]grafico1[/b]":&lt;br&gt;			[b]grafico1 [/b]= true;&lt;br&gt;			break;				&lt;br&gt;		}&lt;br&gt;        	return;&lt;br&gt;	}	&lt;br&gt;&lt;br&gt;function updateChart(idOperadora){	&lt;br&gt;	&lt;br&gt;	if([b]grafico1[/b]){&lt;br&gt;		//DataURL for the chart&lt;br&gt;		var strURL = "../../gerarGraficoKPIB?operadora=" + idOperadora +"&amp;action=detalhe";&lt;br&gt;					&lt;br&gt;		strURL = strURL + "&amp;currTime=" + getTimeForURL();&lt;br&gt;		strURL = escape(strURL);&lt;br&gt;		&lt;br&gt;        	var chartObj = getChartFromId("[b]grafico1[/b]");			&lt;br&gt;		chartObj.setDataURL(strURL);&lt;br&gt;			&lt;br&gt;		} else {&lt;br&gt;		       alert("Please wait for the charts to load.");&lt;br&gt;		       return;&lt;br&gt;		}&lt;br&gt;	} &lt;br&gt;}&lt;br&gt;&lt;br&gt;&lt;%&lt;br&gt;     String chartCode = FusionChartsCreator.createChart(&lt;br&gt;	"FusionCharts/Pie3D.swf",&lt;br&gt;	"../../gerarGraficoKPIB?action=geral", "", "[b]grafico1[/b]",&lt;br&gt;	400, 250, false, true);&lt;br&gt;%&gt; &lt;%=chartCode%&gt;&lt;br&gt;&lt;br&gt;[hr]&lt;br&gt;&lt;br&gt;The new code that works is:&lt;br&gt;&lt;br&gt;[b]graf[/b]=false;&lt;br&gt;	&lt;br&gt;	&lt;br&gt;	function FC_Rendered(DOMId){&lt;br&gt;		switch(DOMId){&lt;br&gt;			case "[b]grafico1[/b]":&lt;br&gt;				[b]graf[/b]= true;&lt;br&gt;				break;				&lt;br&gt;		}&lt;br&gt;		return;&lt;br&gt;	}	&lt;br&gt;&lt;br&gt;function updateChart(idOperadora){	&lt;br&gt;	&lt;br&gt;	if([b]graf[/b]){&lt;br&gt;			//DataURL for the chart&lt;br&gt;		var strURL = "../../gerarGraficoKPIB?operadora=" + idOperadora +"&amp;action=detalhe";&lt;br&gt;					&lt;br&gt;		strURL = strURL + "&amp;currTime=" + getTimeForURL();&lt;br&gt;		strURL = escape(strURL);&lt;br&gt;		&lt;br&gt;        	var chartObj = getChartFromId("[b]grafico1[/b]");			&lt;br&gt;		chartObj.setDataURL(strURL);&lt;br&gt;			&lt;br&gt;		} else {&lt;br&gt;		       alert("Please wait for the charts to load.");&lt;br&gt;		       return;&lt;br&gt;		}&lt;br&gt;	} &lt;br&gt;}&lt;br&gt;&lt;br&gt;&lt;%&lt;br&gt;	String chartCode = FusionChartsCreator.createChart(&lt;br&gt;	    "FusionCharts/Pie3D.swf",&lt;br&gt;	    "../../gerarGraficoKPIB?action=geral", "", "[b]grafico1[/b]",&lt;br&gt;	   400, 250, false, true);&lt;br&gt;%&gt; &lt;%=chartCode%&gt;&lt;br&gt;&lt;br&gt;[hr]&lt;br&gt;&lt;br&gt;My only change is avoid that id and variable names are equals..</description><pubDate>Wed, 19 Sep 2007 09:36:10 GMT</pubDate><dc:creator>bielmenezes</dc:creator></item><item><title>RE: setDataURL() example in docs not working</title><link>http://www.fusioncharts.com/forum/Topic1675-47-1.aspx</link><description>Hi all,&lt;br&gt;Can you please attach the full code that you are using to use setDataURL() and getting this error. Please also specify the browser &amp; OS being used and the error message.&lt;br&gt;&lt;br&gt;IF you want to dynamically (may be repetetively) update the chart after loading it with some data.. you can try the sample attach i here :(rename txt to html)&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;what i have done :&lt;br&gt;1. used registerWithJS option.&lt;br&gt;2. used FC_rendered() function to trap the chart object. (Its essential**)&lt;br&gt;3. After FC_Rendered() is fired (i.e. the full chart is loaded) i intenet to chage its values dynamically and then called setDataURL().&lt;br&gt;[ this u can change to any serverside script page too to get dynamic XML]&lt;br&gt;&lt;br&gt;&lt;br&gt;4. * i used setInterval() to continuously update the chart after 3 seconds.&lt;br&gt;</description><pubDate>Mon, 17 Sep 2007 01:38:03 GMT</pubDate><dc:creator>Sudipto Choudhury</dc:creator></item><item><title>RE: setDataURL() example in docs not working</title><link>http://www.fusioncharts.com/forum/Topic1675-47-1.aspx</link><description>In Firefox (where the code works) here is the output from FireBug:&lt;br&gt;&lt;br&gt;&gt;&gt;&gt; getChartFromId('chart_pipeline_overview');&lt;br&gt;function()&lt;br&gt;&gt;&gt;&gt; getChartFromId('chart_pipeline_overview').setDataURL('http://www.google.com');&lt;br&gt;&gt;&gt;&gt;&lt;br&gt;&lt;br&gt;In IE 7.0, when I use Firebug (Lite) the output for the same commands is as follows:&lt;br&gt;&gt;&gt;&gt; getChartFromId('chart_pipeline_overview');&lt;br&gt;object#chart_pipeline_overview&lt;br&gt;&gt;&gt;&gt; getChartFromId('chart_pipeline_overview').setDataURL('http://www.google.com');&lt;br&gt;undefined&lt;br&gt;&lt;br&gt;Please help!  It seems that the problem lies in the getChartFromId function.  I looked at your online demos and I couldn't see what you were doing differently.&lt;br&gt;-Ben&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;</description><pubDate>Thu, 13 Sep 2007 16:22:16 GMT</pubDate><dc:creator>bmabey</dc:creator></item><item><title>RE: setDataURL() example in docs not working</title><link>http://www.fusioncharts.com/forum/Topic1675-47-1.aspx</link><description>Yeah, I didn't think that would be a problem.  I have no idea why this code is not working in IE.  I have the following:&lt;br&gt;&lt;br&gt;[code]&lt;br&gt;function update_fusion(obj_id, url){&lt;br&gt; //Sometimes, the above URL and XML data gets cached by the browser.&lt;br&gt; //If you want your charts to get new XML data on each request,&lt;br&gt; //you can add the following line:&lt;br&gt; url = url + "&amp;currTime=" + getTimeForURL();&lt;br&gt; //getTimeForURL method is defined below and needs to be included&lt;br&gt; //This basically adds a ever-changing parameter which bluffs&lt;br&gt; //the browser and forces it to re-load the XML data every time.&lt;br&gt; //URLEncode it - NECESSARY.&lt;br&gt; url = escape(url);&lt;br&gt; //Get reference to chart object using Dom ID "FactoryDetailed"&lt;br&gt; var chartObj = getChartFromId(obj_id);&lt;br&gt; //Send request for XML&lt;br&gt; chartObj.setDataURL(url);&lt;br&gt;}&lt;br&gt;&lt;br&gt;/**&lt;br&gt;* getTimeForURL method returns the current time&lt;br&gt;* in a URL friendly format, so that it can be appended to&lt;br&gt;* dataURL for effective non-caching.&lt;br&gt;*/&lt;br&gt;function getTimeForURL(){&lt;br&gt; var dt = new Date();&lt;br&gt; var strOutput = "";&lt;br&gt; strOutput = dt.getHours() + "_" + dt.getMinutes() + "_" + dt.getSeconds() + "_" +&lt;br&gt; dt.getMilliseconds();&lt;br&gt; return strOutput;&lt;br&gt;}&lt;br&gt;[/code]&lt;br&gt;&lt;br&gt;As I said before IE does work correctly with getChartFromId().  The error says that the Object doesn't support this property or method.</description><pubDate>Thu, 13 Sep 2007 15:33:17 GMT</pubDate><dc:creator>bmabey</dc:creator></item><item><title>RE: setDataURL() example in docs not working</title><link>http://www.fusioncharts.com/forum/Topic1675-47-1.aspx</link><description>Ben,&lt;/P&gt;&lt;P&gt;We've not yet cross tested FusionCharts library with Prototype library - Our namespaces for the JavaScript class are entirely different, and as such I think we shouldn't have any conflicts.</description><pubDate>Mon, 10 Sep 2007 11:46:01 GMT</pubDate><dc:creator>Pallav</dc:creator></item><item><title>RE: setDataURL() example in docs not working</title><link>http://www.fusioncharts.com/forum/Topic1675-47-1.aspx</link><description>I have having similar issues.  I am using the code exactly as given in the examples.   They all work perfectly fine in Firefox and Safari but do not work in IE.  The problem is with the getChartFromId function.  In Firefox that function returns another function which the setDataURL function works on.  However, in IE the getChartFromId is returning an object which doesn't support the function setDataURL.  I have gone through the checklist above and doubled checked that it is being registered with JS (I even used the FC_Rendered function to verify this) and that the chart is not in a form tag.  When is curious is that it works in all the browsers except IE.  I am using the Prototype JS library in my app.  Are there known issues with Prototype interfering with your JS libraries in IE?  If you have any further suggestions on how I might resolve this issue please let me know.  Thanks,&lt;br&gt;&lt;br&gt;Ben</description><pubDate>Fri, 07 Sep 2007 11:05:57 GMT</pubDate><dc:creator>bmabey</dc:creator></item><item><title>RE: setDataURL() example in docs not working</title><link>http://www.fusioncharts.com/forum/Topic1675-47-1.aspx</link><description>If you're getting an error that setDataURL/setDataXML is not a function of the chart object, please make sure of the following:&lt;/P&gt;&lt;P&gt;1. Please make sure that you're using FusionCharts v3 charts, as the JavaScript API was introduced in this version. To check whether you're using v3, just match your SWF name with the names listed at &lt;A href="http://www.fusioncharts.com/Docs/Contents/ChartList.html"&gt;http://www.fusioncharts.com/Docs/Contents/ChartList.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;2. Please ensure that you've set registerWithJS flag to 1. For more information on how to do this, please see &lt;A href="http://www.fusioncharts.com/Docs/Contents/JS_Overview.html"&gt;http://www.fusioncharts.com/Docs/Contents/JS_Overview.html&lt;/A&gt;. Basically, you need to set the last parameter in the following code to 1:&lt;BR&gt;var chart1 = new FusionCharts("FusionCharts/Column3D.swf", "chart1Id", "400", "300", "0", "1"); &lt;/P&gt;&lt;P&gt;3. Please make sure that you're not placing the chart inside a FORM element. When the chart is inside a FORM element, the browser cannot access the chart using DOM.&lt;/P&gt;&lt;P&gt;4. Please make sure that you're not calling the setDataURL/setDataXML method before the chart has loaded and rendered. You need to use FC_Rendered function of chart to track the loading of chart as explained at &lt;A href="http://www.fusioncharts.com/Docs/Contents/JS_Overview.html"&gt;http://www.fusioncharts.com/Docs/Contents/JS_Overview.html&lt;/A&gt;. The page's body onLoad event would NOT work, as the chart starts loading after the body has finished loading.&lt;/P&gt;&lt;P&gt;5. Please make sure that you're NOT running the chart from local file system (C:\ , D:\). Instead, run the chart from behind a server (localhost - IIS, Apache etc.). This is because the Flash Player security settings do not allow Chart to JavaScript interaction, unless otherwise specifically set.</description><pubDate>Sun, 02 Sep 2007 02:58:12 GMT</pubDate><dc:creator>Pallav</dc:creator></item><item><title>RE: setDataURL() example in docs not working</title><link>http://www.fusioncharts.com/forum/Topic1675-47-1.aspx</link><description>Any chance of getting an actual answer from InfoSoft?  What exactly do I have to do to my JS to get this dynamic update to work???&lt;br&gt;&lt;br&gt;Please don't tell me to run it on the server, I have already tried.&lt;br&gt;&lt;br&gt;Here is the error I am getting: [b]chartObj.setDataURL is not a function[/b]&lt;br&gt;&lt;br&gt;A real answer would be great!!!</description><pubDate>Fri, 31 Aug 2007 10:54:53 GMT</pubDate><dc:creator>errodr</dc:creator></item><item><title>RE: setDataURL() example in docs not working</title><link>http://www.fusioncharts.com/forum/Topic1675-47-1.aspx</link><description>Here's how we go about it. In FusionCharts.js replace chartObj.setDataXML(strDataXML); with this.addVariable("dataURL",strDataXML). That works!!</description><pubDate>Tue, 28 Aug 2007 01:05:52 GMT</pubDate><dc:creator>lauvshree</dc:creator></item><item><title>RE: setDataURL() example in docs not working</title><link>http://www.fusioncharts.com/forum/Topic1675-47-1.aspx</link><description>The chartObj object is a HTMLEmbedElement object and not a FusionChart Object. This explains why the setDataURL/setDataXML gives an error when invoked on this object. But can you tell us how to go about resolving this?</description><pubDate>Tue, 28 Aug 2007 00:48:17 GMT</pubDate><dc:creator>lauvshree</dc:creator></item><item><title>RE: setDataURL() example in docs not working</title><link>http://www.fusioncharts.com/forum/Topic1675-47-1.aspx</link><description>I tried to run it from the server. Yet getting the same javascript error mentioned earlier. "chartObj.setDataURL is not a function".</description><pubDate>Tue, 28 Aug 2007 00:27:54 GMT</pubDate><dc:creator>lauvshree</dc:creator></item><item><title>RE: setDataURL() example in docs not working</title><link>http://www.fusioncharts.com/forum/Topic1675-47-1.aspx</link><description>Just copy-paste the files to a server and run (either localhost or remote).</description><pubDate>Fri, 20 Jul 2007 02:16:30 GMT</pubDate><dc:creator>Pallav</dc:creator></item><item><title>setDataURL() example in docs not working</title><link>http://www.fusioncharts.com/forum/Topic1675-47-1.aspx</link><description>For the docs that come with the demo version of FusionCharts, there's the "setDataURL()" example under  the"FusionCharts and Javascript" folder. This demo explains the file Download Package &gt; Code &gt; JavaScript &gt; Basics. However, when I try to run this file in my browser (ChangeDataURL()), it gives me the error "chartObj.setDataURL is not a function." I've tried it both in Firefox and IE with the same result. Is this feature disabled in the demo? Why is the help file example throwing an error?</description><pubDate>Wed, 18 Jul 2007 10:35:55 GMT</pubDate><dc:creator>DelvarWorld</dc:creator></item></channel></rss>