Sign in to follow this  
gwdmedia

Can't get FC_Rendered to fire

Recommended Posts

Hi there,

 

 

 

I'm trying to use fusion charts to dynamically update a chart on a page based on a dropdown.

 

 

 

I'm having problems because getting the chart with its ID via getChartFromId() is returning null each time.

 

 

 

The code I'm using is as follows:

 


chartLoaded = false;



function FC_Rendered(id) {

if (id == 'chartId1') {

	chartLoaded = true;

} 

}

var dayChart = new FusionCharts("<?php echo $this->baseUrl (); ?>/fusion/Charts3/Charts/Column2D.swf", "ChartId1", "500", "200", "1", "1");

dayChart.setTransparent(false);

dayChart.setDataURL("/network/revenue-chart-today/objectId/<?php echo $this->operator->getId ()?>/format/xml");

dayChart.render("chart");



function loadChart() {

if (chartLoaded == false) {

	alert("Not yet");

	return;

}

var thisChart = getChartFromId("chartId1");

thisChart.setDataURL("/network/revenue-chart-this-week/objectId/<?php echo $this->operator->getId ()?>/format/xml");

//console.log(thisChart);

}

 

 

 

No matter how long I wait, clicking the button with the onclick"javascript:loadChart()" always says "not yet".

 

 

 

I can manually trip that status by calling FC_Rendered('chartId1') in firebug, and then I get an error that thisChart is null.

 

 

 

I am testing this in firebox and I have fusion charts developer version 3.1.1.

 

 

 

Many thanks,

 

Maz

Share this post


Link to post
Share on other sites

While I'm waiting for a response I've tried another method and run into another problem.

 

 

 

I'm creating the charts as separate named javascript variables and calling chart1.render('chartdiv') on each one. This works fine if I specify an absolute pixel width. If I specify a width of 100%, then the charts will not render after the 1st. No request is ever made to the xml data url.

 

 

 

Maz

Share this post


Link to post
Share on other sites

Hi Maz,

 

 

 

Could you please change your chart id in getChartFromId() method to "ChartId1" instead of "chartId1" ?

 

 

 

Also for your second query please make sure that your DIV should have an absolute pixel value.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this