0

I'm using FusionCharts 3.2.1 and I want to render charts in javascript when the flash player is not installed of disabled in browser. I'm calling the method FusionCharts._fallbackJSChartWhenNoFlash() but nothing happen.

   function updateChart(chartDataJSON) {
        FusionCharts._fallbackJSChartWhenNoFlash();
            var currentSwfName = 'MSCombi2D.swf';
            if (chartDataJSON.swfName) {
                currentSwfName = chartDataJSON.swfName;
            }
            if (prevSwfName != currentSwfName) {
                prevSwfName = currentSwfName;
                var contextPath = document.getElementById('contextPath').value;  
                var swfUrl = contextPath + '/charts/' + currentSwfName;

                if (FusionCharts('residenceChart')) {
                    FusionCharts('residenceChart').dispose();
                }

                new FusionCharts({
                    id: 'residenceChart',
                    swfUrl:swfUrl,
                    renderAt:'consumptionChartDiv',
                    dataFormat:'json',
                    dataSource: chartDataJSON,
                    registerWithJS: 1,
                    width: 730,
                    height: 300,
                    debugMode: 0
                }).render();
            } else {
                FusionCharts('residenceChart').setJSONData(chartDataJSON);
            }
}
spauny
  • 4,976
  • 9
  • 44
  • 61

2 Answers2

1

Is it mandatory that you stick to FusionCharts 3.2.1? If you upgrade to the latest version (which is free if you are already a customer), this issue will be solved.

Since FusionCharts 3.2.2, the component automatically renders JavaScript charts when Flash Player is not available and you would not need to explicitly call FusionCharts._fallbackJSChartWhenNoFlash(); In fact, this method is removed from the latest API.

However, if you still wish to stick to v3.2.1, I would recommend you first look into the following:

  1. Ensure that you have all the accompanying JavaScript file that was supplied with the FusionCharts package and kept beside the `FusionCharts.js`` file.
  2. Since, the JavaScript charts require additional JS files, they are loaded dynamically when needed. However, it might havae failed for your case; try manually adding the JavaScript files to the page head post inclusion of FusionCharts.js
  3. If you have any JavaScript error on your browsers debug/js console, look for hints from the error message. The FusionCharts documentation and the product forum may help you figure out the cause of the error message.
  4. Just as a precaution, ensure that the swfName passed via JSON is in proper case. FusionCharts 3.2.1 JavaScript charts had a swfUrl case-sensitivity issue.
Shamasis Bhattacharya
  • 3,392
  • 3
  • 20
  • 24
-2

It seems that the parameters for the FusionCharts Constructor are not in the proper order.

From the FusionCharts Documentation:

var myChart = new FusionCharts("FusionCharts/Column3D.swf", "myChartId", "400", "300", "chartContainer", {dataFormat : "json", dataSource : chartDataJSON});

The above code should work for you.

Hrishikesh Choudhari
  • 11,617
  • 18
  • 61
  • 74