SteveC

Using Setcurrentrenderer Not Working For Me

Recommended Posts

Hi,

 

I'm trying to use the FusionCharts.setCurrentRenderer('javascript') to render my charts as Javascript instead of Flash but I must be doing something wrong as it still renders using Flash.

If someone can point me in the right direction, it would be much appreciated.

 

Thank you very much,

Steve

 

Here is the XML I'm using: (FusionCharts v3.2)

 

<script type="text/javascript"><!-- FusionCharts.setCurrentRenderer('javascript'); // --></script>

 

<div id='Chart23Div' >

 

Chart.

 

</div>

 

 

 

<script type="text/javascript">

 

//Instantiate the Chart

 

var chart_Chart23 = new FusionCharts("FusionCharts/MSCombi2D.swf", "Chart23", "720", "400", "0", "1","","noScale","EN");

 

 

 

 

 

//Provide entire XML data using dataXML method

 

chart_Chart23.setDataXML("<chart caption='EBIT and EBIT % to Plan' adjustDiv='0' numDivLines='2' exportFileName='Left_Side_Settings_1_-1_2011_6' plotGradientColor='' animation='0' canvasBorderThickness='1' showBorder='0' outCnvBaseFont='Arial' outCnvBaseFontSize='12' outCnvbaseFontColor='ff0000' bgColor='ffffff' bgAlpha='100' YAxisName='Amount ($M)' yAxisMinValue='0' yAxisMaxValue='3' showLegend='0' decimals='2' borderSize='0' labelDisplay='Rotate' slantLabels='1' exportEnabled='1' exportAction='save' exportAtClient='0' exportHandler='FusionCharts/ASP_Net/FCExporter.aspx' use3DLighting='0' ><categories ><category label='2009' /><category label='2010' /><category label='YTD' /><category label='Jan-11' /><category label='Feb-11' /><category label='Mar-11' /><category label='Apr-11' /><category label='May-11' /><category label='Jun-11' /><category label='Jul-11' /><category label='Aug-11' /><category label='Sep-11' /><category label='Oct-11' /><category label='Nov-11' /><category label='Dec-11' /></categories><dataset seriesName='EBIT' showValues='1' color='0a3c91' includeInLegend='1' renderAs='Column' parentYAxis='P' valuePosition='auto' ><set value='0.480229' /><set value='0.916563' /><set value='1.812716' /><set value='1.774' /><set value='1.503382' /><set value='2.854' /><set value='0.896' /><set value='1.322914' /><set value='2.526' /><set value='' /><set value='' /><set value='' /><set value='' /><set value='' /><set value='' /></dataset><dataset seriesName='EBIT Plan' showValues='0' color='ff0000' includeInLegend='1' renderAs='Line' parentYAxis='P' valuePosition='auto' ><set value='' /><set value='' /><set value='1.129' /><set value='1.129' /><set value='1.129' /><set value='1.129' /><set value='1.129' /><set value='1.129' /><set value='1.129' /><set value='1.129' /><set value='1.129' /><set value='1.129' /><set value='1.129' /><set value='1.129' /><set value='1.129' /></dataset><styles><definition><style name='MyTitleFont' type='font' font='Arial' size='12' align='center' color='ff0000' /><style name='MyXAxisFont' type='font' font='Arial' size='12' /><style name='MyYAxisFont' type='font' font='Arial' size='12' color='ff0000' bold='1' /></definition><application><apply toObject='CAPTION' styles='MyTitleFont' /><apply toObject='SUBCAPTION' styles='MyTitleFont' /><apply toObject='XAxisName' styles='MyXAxisFont' /><apply toObject='PAxisName' styles='MyYAxisFont' /></application></styles></chart>");

 

 

 

// Provide Transparent SWF

 

chart_Chart23.setTransparent(false);

 

//Finally, render the chart.

 

chart_Chart23.render("Chart23Div");

 

</script>

 

Share this post


Link to post
Share on other sites
Guest Angshu

Hi,

 

Welcome to FusionCharts Forum!smile.gif

 

Please find the modified code below:

 

<html>
 <head>        
   <title>My First chart using FusionCharts - Using pure JavaScript</title>    
   <script type="text/javascript" src="FusionCharts/FusionCharts.js"></script>
 </head>   
 <body>  
 <div id='Chart23Div' >

Chart.

</div>
<script type="text/javascript">
FusionCharts.setCurrentRenderer('javascript');


var chart_Chart23 = new FusionCharts("FusionCharts/MSCombi2D.swf", "Chart23", "720", "400", "0", "1","","noScale","EN");

chart_Chart23.setXMLData("<chart caption='EBIT and EBIT % to Plan' adjustDiv='0' numDivLines='2' exportFileName='Left_Side_Settings_1_-1_2011_6' plotGradientColor='' animation='0' canvasBorderThickness='1' showBorder='0' outCnvBaseFont='Arial' outCnvBaseFontSize='12' outCnvbaseFontColor='ff0000' bgColor='ffffff' bgAlpha='100' YAxisName='Amount ($M)' yAxisMinValue='0' yAxisMaxValue='3' showLegend='0' decimals='2' borderSize='0' labelDisplay='Rotate' slantLabels='1' exportEnabled='1' exportAction='save' exportAtClient='0' exportHandler='FusionCharts/ASP_Net/FCExporter.aspx' use3DLighting='0' ><categories ><category label='2009' /><category label='2010' /><category label='YTD' /><category label='Jan-11' /><category label='Feb-11' /><category label='Mar-11' /><category label='Apr-11' /><category label='May-11' /><category label='Jun-11' /><category label='Jul-11' /><category label='Aug-11' /><category label='Sep-11' /><category label='Oct-11' /><category label='Nov-11' /><category label='Dec-11' /></categories><dataset seriesName='EBIT' showValues='1' color='0a3c91' includeInLegend='1' renderAs='Column' parentYAxis='P' valuePosition='auto' ><set value='0.480229' /><set value='0.916563' /><set value='1.812716' /><set value='1.774' /><set value='1.503382' /><set value='2.854' /><set value='0.896' /><set value='1.322914' /><set value='2.526' /><set value='' /><set value='' /><set value='' /><set value='' /><set value='' /><set value='' /></dataset><dataset seriesName='EBIT Plan' showValues='0' color='ff0000' includeInLegend='1' renderAs='Line' parentYAxis='P' valuePosition='auto' ><set value='' /><set value='' /><set value='1.129' /><set value='1.129' /><set value='1.129' /><set value='1.129' /><set value='1.129' /><set value='1.129' /><set value='1.129' /><set value='1.129' /><set value='1.129' /><set value='1.129' /><set value='1.129' /><set value='1.129' /><set value='1.129' /></dataset><styles><definition><style name='MyTitleFont' type='font' font='Arial' size='12' align='center' color='ff0000' /><style name='MyXAxisFont' type='font' font='Arial' size='12' /><style name='MyYAxisFont' type='font' font='Arial' size='12' color='ff0000' bold='1' /></definition><application><apply toObject='CAPTION' styles='MyTitleFont' /><apply toObject='SUBCAPTION' styles='MyTitleFont' /><apply toObject='XAxisName' styles='MyXAxisFont' /><apply toObject='PAxisName' styles='MyYAxisFont' /></application></styles></chart>");

chart_Chart23.setTransparent(false);

chart_Chart23.render("Chart23Div");

</script>
</body>
</html>

 

 

Please find the screenshot attached for your reference.

 

Hope this helps.smile.gif

post-10517-0-17635800-1312525124_thumb.png

Share this post


Link to post
Share on other sites

Thanks for the code sample.

 

I tried using what you specified but received the error 'Object does not support that property or method'. I believe we must be using an older version of FusionCharts for the scripting. When I view the MSLine.swf with ?debugMode=1, it lists the version as v3.2.1. However, when I look at the FusionCharts.js file, it is dated as 08/18/2010 10:45AM and the header portion of the file lists this informaton:

/**

* FusionCharts: Flash Player detection and Chart embedding.

* Version: 1.2.3 (15th September, 2008) - Added fix for % and & characters. Additional fixes to properly handle double quotes and single quotes in setDataXML() function.

* Version: 1.2.2 (10th July, 2008) - Added fix for % scaled dimensions, fixes in setDataXML() and setDataURL() functions

* Version: 1.2.1 (21st December, 2007) - Added setting up transparent/opaque mode: setTransparent() function

* Version: 1.2 (1st November, 2007) - Added FORM fixes for IE

* Version: 1.1 (29th June, 2007) - Added Player detection, New conditional fixes for IE

*

* Morphed from SWFObject (http://blog.deconcept.com/swfobject/) under MIT License:

* http://www.opensource.org/licenses/mit-license.php

*

*/

 

Doing a search for 'setCurrentRenderer' in the fusioncharts.js file results in no matches found.

 

I will try downloading the latest version and see if that makes a difference. (I'm confident it will.)

 

In the meantime, can you confirm that the FusionCharts.js file I listed really is from FusionCharts v1.2.3 ??

 

Thank you very much,

Steve

 

Hi,

 

Welcome to FusionCharts Forum!smile.gif

 

Please find the modified code below:

 

<html>
 <head>        
   <title>My First chart using FusionCharts - Using pure JavaScript</title>    
   <script type="text/javascript" src="FusionCharts/FusionCharts.js"></script>
 </head>   
 <body>  
 <div id='Chart23Div' >

Chart.

</div>
<script type="text/javascript">
FusionCharts.setCurrentRenderer('javascript');


var chart_Chart23 = new FusionCharts("FusionCharts/MSCombi2D.swf", "Chart23", "720", "400", "0", "1","","noScale","EN");

chart_Chart23.setXMLData("<chart caption='EBIT and EBIT % to Plan' adjustDiv='0' numDivLines='2' exportFileName='Left_Side_Settings_1_-1_2011_6' plotGradientColor='' animation='0' canvasBorderThickness='1' showBorder='0' outCnvBaseFont='Arial' outCnvBaseFontSize='12' outCnvbaseFontColor='ff0000' bgColor='ffffff' bgAlpha='100' YAxisName='Amount ($M)' yAxisMinValue='0' yAxisMaxValue='3' showLegend='0' decimals='2' borderSize='0' labelDisplay='Rotate' slantLabels='1' exportEnabled='1' exportAction='save' exportAtClient='0' exportHandler='FusionCharts/ASP_Net/FCExporter.aspx' use3DLighting='0' ><categories ><category label='2009' /><category label='2010' /><category label='YTD' /><category label='Jan-11' /><category label='Feb-11' /><category label='Mar-11' /><category label='Apr-11' /><category label='May-11' /><category label='Jun-11' /><category label='Jul-11' /><category label='Aug-11' /><category label='Sep-11' /><category label='Oct-11' /><category label='Nov-11' /><category label='Dec-11' /></categories><dataset seriesName='EBIT' showValues='1' color='0a3c91' includeInLegend='1' renderAs='Column' parentYAxis='P' valuePosition='auto' ><set value='0.480229' /><set value='0.916563' /><set value='1.812716' /><set value='1.774' /><set value='1.503382' /><set value='2.854' /><set value='0.896' /><set value='1.322914' /><set value='2.526' /><set value='' /><set value='' /><set value='' /><set value='' /><set value='' /><set value='' /></dataset><dataset seriesName='EBIT Plan' showValues='0' color='ff0000' includeInLegend='1' renderAs='Line' parentYAxis='P' valuePosition='auto' ><set value='' /><set value='' /><set value='1.129' /><set value='1.129' /><set value='1.129' /><set value='1.129' /><set value='1.129' /><set value='1.129' /><set value='1.129' /><set value='1.129' /><set value='1.129' /><set value='1.129' /><set value='1.129' /><set value='1.129' /><set value='1.129' /></dataset><styles><definition><style name='MyTitleFont' type='font' font='Arial' size='12' align='center' color='ff0000' /><style name='MyXAxisFont' type='font' font='Arial' size='12' /><style name='MyYAxisFont' type='font' font='Arial' size='12' color='ff0000' bold='1' /></definition><application><apply toObject='CAPTION' styles='MyTitleFont' /><apply toObject='SUBCAPTION' styles='MyTitleFont' /><apply toObject='XAxisName' styles='MyXAxisFont' /><apply toObject='PAxisName' styles='MyYAxisFont' /></application></styles></chart>");

chart_Chart23.setTransparent(false);

chart_Chart23.render("Chart23Div");

</script>
</body>
</html>

 

 

Please find the screenshot attached for your reference.

 

Hope this helps.smile.gif

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