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