setDataURL() example in docs not working
FusionCharts Forum
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        


««123»»

setDataURL() example in docs not working Expand / Collapse
Author
Message
Posted 9/13/2007 4:22:16 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 9/13/2007 4:24:47 PM
Posts: 3, Visits: 4
In Firefox (where the code works) here is the output from FireBug:

>>> getChartFromId('chart_pipeline_overview');
function()
>>> getChartFromId('chart_pipeline_overview').setDataURL('http://www.google.com');
>>>

In IE 7.0, when I use Firebug (Lite) the output for the same commands is as follows:
>>> getChartFromId('chart_pipeline_overview');
object#chart_pipeline_overview
>>> getChartFromId('chart_pipeline_overview').setDataURL('http://www.google.com');
undefined

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.
-Ben



Post #2391
Posted 9/17/2007 1:38:03 AM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Moderators
Last Login: 2 days ago @ 2:56:41 AM
Posts: 704, Visits: 1,139
Hi all,
Can you please attach the full code that you are using to use setDataURL() and getting this error. Please also specify the browser & OS being used and the error message.

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)



what i have done :
1. used registerWithJS option.
2. used FC_rendered() function to trap the chart object. (Its essential**)
3. After FC_Rendered() is fired (i.e. the full chart is loaded) i intenet to chage its values dynamically and then called setDataURL().
[ this u can change to any serverside script page too to get dynamic XML]


4. * i used setInterval() to continuously update the chart after 3 seconds.


Regards,

Sudipto Choudhury
FusionCharts Team


  Post Attachments 
JSSetDataURL.txt (54 views, 594 bytes)
Data.xml (11 views, 530 bytes)
Data2.xml (9 views, 564 bytes)
Post #2429
Posted 9/19/2007 9:36:10 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 9/19/2007 2:02:20 PM
Posts: 1, Visits: 3
I had the same problem with IE7, the problem was the name of the variable in the method updateChart.





My old code:

grafico1=false;

function FC_Rendered(DOMId){

switch(DOMId){
case "grafico1":
grafico1 = true;
break;
}
return;
}

function updateChart(idOperadora){

if(grafico1){
//DataURL for the chart
var strURL = "../../gerarGraficoKPIB?operadora=" + idOperadora +"&action=detalhe";

strURL = strURL + "&currTime=" + getTimeForURL();
strURL = escape(strURL);

var chartObj = getChartFromId("grafico1");
chartObj.setDataURL(strURL);

} else {
alert("Please wait for the charts to load.");
return;
}
}
}

<%
String chartCode = FusionChartsCreator.createChart(
"FusionCharts/Pie3D.swf",
"../../gerarGraficoKPIB?action=geral", "", "grafico1",
400, 250, false, true);
%> <%=chartCode%>




The new code that works is:

graf=false;


function FC_Rendered(DOMId){
switch(DOMId){
case "grafico1":
graf= true;
break;
}
return;
}

function updateChart(idOperadora){

if(graf){
//DataURL for the chart
var strURL = "../../gerarGraficoKPIB?operadora=" + idOperadora +"&action=detalhe";

strURL = strURL + "&currTime=" + getTimeForURL();
strURL = escape(strURL);

var chartObj = getChartFromId("grafico1");
chartObj.setDataURL(strURL);

} else {
alert("Please wait for the charts to load.");
return;
}
}
}

<%
String chartCode = FusionChartsCreator.createChart(
"FusionCharts/Pie3D.swf",
"../../gerarGraficoKPIB?action=geral", "", "grafico1",
400, 250, false, true);
%> <%=chartCode%>




My only change is avoid that id and variable names are equals..
Post #2461
Posted 11/9/2007 1:53:48 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 11/30/2007 12:43:47 PM
Posts: 1, Visits: 2
I encountered the "setDataURL is not a function" error as well.

One of Pallav's previous posts mentioned:

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:
var chart1 = new FusionCharts("FusionCharts/Column3D.swf", "chart1Id", "400", "300", "0", "1");


In my controller that is responsible for contructing the chart I was using:

renderChart("/flash/Column2D.swf?ChartNoDataText=Please select a District to view detailed data.", "", "", "FactoryDetailed", 300, 250, "0", "1")


but I found that switching "0" to false and "1" to true will fix the error.

Hope this helps.


--craan
Post #3001
Posted 11/10/2007 10:18:49 PM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Moderators
Last Login: 2 days ago @ 2:56:41 AM
Posts: 704, Visits: 1,139
Hi all,
 
TO set RegisterWithJS :
 
This code is required in Javascript :
 
var chart1 = new FusionCharts("FusionCharts/Column3D.swf", "chart1Id", "400", "300", "0", "1");
 
while using ASP/PHP etc. -

renderChart("/flash/Column2D.swf?ChartNoDataText=Please select a District to view detailed data.", "", "<chart></chart>", "FactoryDetailed", 300, 250, false, true)



Regards,

Sudipto Choudhury
FusionCharts Team
Post #3004
Posted 1/3/2008 1:41:13 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 2/5/2008 10:41:30 AM
Posts: 3, Visits: 5
FusionCharts is using Adobe's ExternalInterface API 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.

A couple things to try:

  1. 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.
     
  2. 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):

setDataXML: function(strDataXML){
    //If being set initially
    if (this.initialDataSet==false){
        //This method sets the data XML for the chart INITIALLY.
        this.addVariable('dataXML',strDataXML);
        //Update flag
        this.initialDataSet = true;
    }else{
        //Else, we update the chart data using External Interface
        //Get reference to chart object
        var chartObj = infosoftglobal.FusionChartsUtil.getChartObject(this.getAttribute('id'));
        if (!chartObj.setDataXML)
        {
            __flash__addCallback(chartObj, "setDataXML");
        }
        chartObj.setDataXML(strDataXML);
    }
},

 



www.timvasil.com
Post #3595
Posted 1/6/2008 8:10:50 AM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Moderators
Last Login: 2 days ago @ 2:56:41 AM
Posts: 704, Visits: 1,139
Hi,

Thanks for the valuable R&D.

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.

Regards,

Sudipto Choudhury
FusionCharts Team

Post #3616
Posted 1/9/2008 10:06:23 AM