Change SWF dynamically
FusionCharts Forum
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



Change SWF dynamically Expand / Collapse
Author
Message
Posted 10/12/2007 11:15:18 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 10/14/2007 6:11:20 PM
Posts: 2, Visits: 3
I would like to use multiple charts in a page and let users choose different charts for different types of data. Changing the XML url or XML string isn;t a problem, but is there a way to dynamically change the SWF file and rerender a chart ?

I've tried using :

charObj.setAttribute('swf', 'new/flash/source.swf');
charObj.render('chartdiv1');

But this doesn't seem to do the trick. At the moment I'm just not registering my charts in JS and rebuilding the entire chart object each time. But this approach doesn't feel elegant enough.
Post #2705
Posted 10/13/2007 10:12:57 AM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Moderators
Last Login: Yesterday @ 4:15:20 AM
Posts: 772, Visits: 1,228
hi,

i am afraid that that process is the only simple way out, because you need to load the swf everytime you need to change the chart.

Regards,

Sudipto Choudhury
FusionCharts Team

Post #2707
Posted 10/14/2007 6:14:15 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 10/14/2007 6:11:20 PM
Posts: 2, Visits: 3
Thanks for the confirmation.

The performance isn't too bad using that method but I may adjust my page design to accommodate 2 visual charts then I won't need to reload the swf file.
Post #2710
Posted 11/5/2007 2:30:49 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 4/30/2008 4:55:31 PM
Posts: 2, Visits: 4
Could easily be done via an AJAX call, no ?
Post #2978
Posted 11/6/2007 12:41:39 AM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Moderators
Last Login: Yesterday @ 4:15:20 AM
Posts: 772, Visits: 1,228
Hi,

if you wish to relaod the swf using AJAX ..i mean setting Div 's innerHTML from responseText, please do not accept any javascript as responseText becuase that wont evaluate. Rather try to render your chart HTML  from serverside using renderChartHTML (using FusionCharts.asp/FusionCharts.php/.NET assembly etc.) method.

If you have no need to change your chart type .. you can simply fetch the XML using ajax and set it live to the existing chart using setDataXML js method.

Regards,

Sudipto Choudhury
FusionCharts Team

Post #2981
Posted 11/19/2007 12:01:49 PM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: 8/26/2008 8:21:01 PM
Posts: 43, Visits: 74
I am having difficulties getting this to work correctly.

I decided to re-draw the entire graph each time, on load of the page the graph renders fine.
But running this javascript:

function da_DrawChart(type,webpath,query,w,h,debug) {

var width = 800, height = 560;
try {
if(w != undefined) {
width = w;
}
if(h != undefined) {
height = h;
}
//var chart1 = new FusionCharts("/NoAuth/charts/Column3D.swf", "RTDynamicChart", width, height, debug, "1");
var chart1 = new FusionCharts(type, "RTDynamicChart", width, height, debug, "1");
if((query == undefined) || (query == null))
{
//initialize the chart
chart1.setDataXML("");
} else {
chart1.setDataURL( webpath + escape(escape(query)) );
}
chart1.render("fusion_chart");//this is the div tag the graph will be rendered in

} catch(e) {
alert("ERROR: " + e);
}


}


I use the same exact function when I load the page, I have not seen a clear explanation why one function works the first time, and not the second. Do I need to completely delete the DOM object or use another ID?


Here is my XML for the first one:
Could someone fix the code or tell me how to display XML inline, code does not work...
[verbatim]

















[/verbatim]

Clicking the link inside the SWF does not take me to the correct data (it would be nice for the fusion charts to give us the real link, as using special characters does not resolve correctly when you click the link), I know this.
But I do know that rendering the graph separate, or even first will draw the graph.

Here is the debug for the second graph:
Info: Chart loaded and initialized.
Initial Width: 800
Initial Height: 560
Scale Mode: noScale
Debug Mode: Yes
Application Message Language: EN
Version: 3.0.4
Chart Type: Single Series 3D Column Chart
Chart Objects:
BACKGROUND
CANVAS
CAPTION
SUBCAPTION
YAXISNAME
XAXISNAME
DIVLINES
YAXISVALUES
DATALABELS
DATAVALUES
TRENDLINES
TRENDVALUES
DATAPLOT
TOOLTIP
VLINES

INFO: XML Data provided using dataURL method.
dataURL provided: /Search/ChartFusion.xml?Query%3DQueue%20%3D%20%27TSE%27%20AND%20%28%20
Created%20%20%3E%20%272007-11-18%2008%3A00%3A00%27%20and%20Created
%20%20%3C%20%272007-11-24%2008%3A00%3A00%27%29%26PrimaryGroupBy%3DCreatedDaily
dataURL invoked:


Post #3092
Posted 11/19/2007 3:45:00 PM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: 8/26/2008 8:21:01 PM
Posts: 43, Visits: 74
Additionally, I have verified that my link is returning XML correctly, it seems everything is fine.
I think this might be a javascript problem.

Here is a sample string of what resolved fine in my browser address path:

http://host/Search/ChartFusion.xml?Query=Queue = 0 AND ( Created > '2007-11-18 08:00:00' and Created < '2007-11-24 08:00:00')&Query2=Queue = 0 AND ( Resolved > '2007-11-18 08:00:00' and Resolved < '2007-11-24 08:00:00')&SecondaryGroupBy=ResolvedMonthly&debug=&PrimaryGroupBy=CreatedDaily

Post #3093
Posted 11/20/2007 1:33:51 AM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Moderators
Last Login: Yesterday @ 4:15:20 AM
Posts: 772, Visits: 1,228
Hi,
Can you please check the pointers and give me feedback one by 1 ?

1. Are you running the code in a localhost or server? IF not run in localhost or any server
2. Why are using using double escaping while sending DataURL?

IT seem that the XML is not getting received somehow...please check the above poiinters for this..may be the double escape is doing the thing


Regards,

Sudipto Choudhury
FusionCharts Team
Post #3102
« Prev Topic | Next Topic »


Permissions Expand / Collapse