Updating FusionChart component with JavaScript
An html page contains F开发者_Python百科usionCharts component. Below this component are a couple of html controls supposed to filter date for this component. Initially, there was a problem updating the chart component, upon clicking "Filter" button I used the following code:
currentChart.setDataURL(url);
currentChart.render("ChartDiv");
It didn't work. It merely reloaded the same url. It worked only when I started to nullify previous chart object and created a new one at the same place, instead of updating
currentChart = new FusionCharts('/FusionCharts/Maps/FCMap_WorldwithCountries.swf', "countryChart", "550", "200", "0", "1");
currentChart.setDataURL(url);
currentChart.render("ChartDiv");
Am I right that one cannot update existing chart object, only recreate it with a new url?
Could you please try with the following code to update your chart dynamically?
var fc = getChartFromId("countryChart");
fc.setDataURL(url);
精彩评论