setDataURL() example in docs not working
#1
Posted 18 July 2007 - 10:35 AM
Other Replies To This Topic
#2
Posted 20 July 2007 - 02:16 AM
Pallav Nadhani
Co-founder & CEO, FusionCharts Team
Other Replies To This Topic
#3
Posted 28 August 2007 - 12:27 AM
Other Replies To This Topic
#4
Posted 28 August 2007 - 12:48 AM
Other Replies To This Topic
#5
Posted 28 August 2007 - 01:05 AM
Other Replies To This Topic
#6
Posted 31 August 2007 - 10:54 AM
Please don't tell me to run it on the server, I have already tried.
Here is the error I am getting: chartObj.setDataURL is not a function
A real answer would be great!!!
Other Replies To This Topic
#7
Posted 02 September 2007 - 02:58 AM
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 http://www.fusioncharts.com/Docs/Contents/ChartList.html
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");
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.
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 http://www.fusioncharts.com/Docs/Contents/JS_Overview.html. The page's body onLoad event would NOT work, as the chart starts loading after the body has finished loading.
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.
Pallav Nadhani
Co-founder & CEO, FusionCharts Team
Other Replies To This Topic
#8
Posted 07 September 2007 - 11:05 AM
Ben
Other Replies To This Topic
#9
Posted 10 September 2007 - 11:46 AM
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.
Pallav Nadhani
Co-founder & CEO, FusionCharts Team
Other Replies To This Topic
#10
Posted 13 September 2007 - 03:33 PM
function update_fusion(obj_id, url){
//Sometimes, the above URL and XML data gets cached by the browser.
//If you want your charts to get new XML data on each request,
//you can add the following line:
url = url + "&currTime=" + getTimeForURL();
//getTimeForURL method is defined below and needs to be included
//This basically adds a ever-changing parameter which bluffs
//the browser and forces it to re-load the XML data every time.
//URLEncode it - NECESSARY.
url = escape(url);
//Get reference to chart object using Dom ID "FactoryDetailed"
var chartObj = getChartFromId(obj_id);
//Send request for XML
chartObj.setDataURL(url);
}
/**
* getTimeForURL method returns the current time
* in a URL friendly format, so that it can be appended to
* dataURL for effective non-caching.
*/
function getTimeForURL(){
var dt = new Date();
var strOutput = "";
strOutput = dt.getHours() + "_" + dt.getMinutes() + "_" + dt.getSeconds() + "_" +
dt.getMilliseconds();
return strOutput;
}
As I said before IE does work correctly with getChartFromId(). The error says that the Object doesn't support this property or method.
Other Replies To This Topic
#11
Posted 13 September 2007 - 04:22 PM
>>> 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
Other Replies To This Topic
#12
Posted 17 September 2007 - 01:38 AM
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.
Attached File(s)
-
JSSetDataURL.txt (594bytes)
Number of downloads: 267 -
Data.xml (530bytes)
Number of downloads: 111 -
Data2.xml (564bytes)
Number of downloads: 123
Other Replies To This Topic
#13
Posted 19 September 2007 - 09:36 AM
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..
Other Replies To This Topic
#14
Posted 09 November 2007 - 01:53 PM
One of Pallav's previous posts mentioned:
Quote
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
Other Replies To This Topic
#15
Posted 10 November 2007 - 10:18 PM
renderChart("/flash/Column2D.swf?ChartNoDataText=Please select a District to view detailed data.", "", "<chart></chart>", "FactoryDetailed", 300, 250, false, true)Other Replies To This Topic
#16
Posted 03 January 2008 - 01:41 AM
A couple things to try:
- 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.
- 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);
}
},
Other Replies To This Topic
#17
Posted 06 January 2008 - 08:10 AM
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.
Other Replies To This Topic
#18
Posted 09 January 2008 - 10:06 AM
-Tim
Other Replies To This Topic
#19
Posted 09 January 2008 - 11:23 AM
Mozilla is reporting that 'chartRef.feedData is not a function'.
I think this feedData() function is still confusing many.
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).
Hope to get some useful clarification.
Thanks in advance.
Other Replies To This Topic
#20
Posted 10 January 2008 - 05:22 AM
Other Replies To This Topic
#21
Posted 10 January 2008 - 05:24 AM
Other Replies To This Topic
#22
Posted 03 July 2009 - 08:09 AM
We are really excited to announce the release of FusionCharts for Flex v1.1 featuring the following:
- 12 new chart types: 7 new gauges including Angular gauge, LED gauge and Linear gauge, Spark chart and Bullet graphs have been added.
- All the gauges can fetch data in real-time and come with alert managers and message loggers.
- All the charts and gauges can now be natively exported as images and PDFs.
- The data for all the charts can be exported as CSV.
- Data sets can now have custom text labels instead of numeric values.
- The charts can handle a lot more events to help you manipulate them better.
- Trendlines can also have custom tool-text.
- Custom color palettes can be defined for the data plots.
Learn more about it from www.fusioncharts.com/flex and learn more on whats new from http://www.fusioncha...ionHistory.asp.
Existing customers can upgrade to the new version from www.fusioncharts.com/PUC.
Rajroop Bhaduri
FusionCharts Team
Help us improve our documentation with your precious feedback at:
http://documentation...sioncharts.com/
Follow us @Twitter

Back to top
MultiQuote