SuperDelic

Javascript Renderer Not...rendering

Recommended Posts

I am having an issue where the Javascript renderer is not firing off.

 

I have the fusionCharts_3.2.1.js, highcharts.js and jquery.min.js files in the same folder, and the Flash versions of the charts work just fine. However, forcing it to render in Javascript doesn't seem to be doing anything, either in my browser or my iPod Touch.

 

It doesn't throw any errors or warnings, either. Can someone point me in the right direction?

 

Below is my code:

 

function loadContent() {

// Add chart's div to DOM.

$("body").append('<div id="divChart_a"></div>');

 

// Force JavaScript rendering.

FusionCharts.setCurrentRenderer("javascript");

 

// FusionCharts SWF file & parameters.

var chart_a = new FusionCharts("../swf/Column3D.swf", "chrt_a", "100%", "100%", "0", "1");

 

// FusionCharts chart data.

chart_a.setXMLData('<chart animation="1" caption="Purchase Intent" chartLeftMargin="20" chartRightMargin="20" chartTopMargin="15" chartBottomMargin="10" canvasPadding="30" exportEnabled="1" yAxisMinValue="0" yAxisMaxValue="10" numDivLines="3" showBorder="1" showLegend="1" legendPosition="RIGHT" legendMarkerCircle="0" showValues="1" placeValuesInside="0" labelDisplay="WRAP" decimals="1" forceDecimals="1" canvasBorderColor="666666" canvasBorderThickness="1" canvasBorderAlpha="0" showCanvasBg="1" canvasBgColor="CCCCCC" canvasBgAlpha="0" bgColor="FFF89B,FFFFFF,FFF89B" outCnvBaseFont="Verdana" baseFont="Verdana" outCnvBaseFontColor="000000" baseFontColor="000000" outCnvbaseFontSize="10" baseFontSize="10"><set label="RZ" value="8.2" /><set label="SM" value="8.1" /><set label="RL" value="7.8" /><set label="ON" value="7.8" /><set label="EX" value="7.7" /><set label="SP" value="7.5" /><set label="MB" value="7.2" /><set label="SM2A" value="6.2" /><set label="SM2B" value="5.4" /></chart>');

 

// Now render FusionCharts.

chart_a.render("divChart_a");

}

Share this post


Link to post
Share on other sites

Your code does work, indeed. However, after prying into FusionCharts Javascript code, I found that window.Highcharts keeps returning "undefined" in the checkFCCReady function, as if it's not loading the highcharts.js file.

 

The baseURL variable used by the loadFCC function is empty, which is what I expected since the highcharts.js file is supposed to be in the same directory as the FusionCharts_3.2.1.js file. The problem is that the baseURL variable is supposed to be in relation to the calling PHP page. Using the directory structure below:

 

Main Directory

css/

images/

js/
FusionCharts_3.2.1.js and highcharts.js are in this directory.

php/
The main page which calls FusionCharts_3.2.1.js and highcharts.js is in this directory.

swf/

xml/

If I change loadScript(baseURL + 'highcharts.js') to loadScript('../js/highcharts.js'), everything works fine.

Share this post


Link to post
Share on other sites

Also, FusionCharts_fallbackJSChartWhenNoFlash() does not work (as per the Documentation page), but FusionCharts._fallbackJSChartWhenNoFlash() does (notice the period after FusionCharts).

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