Ana Tag Report post Posted June 7, 2012 Hi, I am trying to set caption for chart using setChartAttribute javascript method but chart caption is not changing. My code is as follows (this is based on the sample I got from this site): <html> <head> <title>Update Chart data</title> <script type="text/javascript" src="FusionCharts.js"> </script> </head> <body> <center> <div id="chartContainer">Chart will load here!</div> <script type="text/javascript"><!-- var myChart = new FusionCharts( 'Column2D.swf', 'MyChart', '300', '240', '0', '1' ); myChart.setXMLData("<chart caption='Issues' showValues='0' yAxisName='Issues' xAxisName='Month' > <set label='Dec 2011' value='3' /><set label='Jan 2012' value='18' /><set label='Feb 2012' value='21' /><set label='Mar 2012' value='19' /><set label='Apr 2012' value='55' /><set label='May 2012' value='23' /></chart>"); myChart.render("chartContainer"); function changeAttribute() { // get chart reference var chartReference = FusionCharts( 'MyChart' ); chartReference.setChartAttribute({"caption" : "Issues opened"}); } // --> </script> <input type="button" onClick="changeAttribute();" value="Change Caption" > </center> </body> </html> When I click on 'Change Caption' button chart is not being updated with new caption. I added alerts after the call setChartAttribute, it gives the new caption but chart is not updated. I tried adding render after it and it still not picking up the new caption. Could anyone please help me? btw, I am using v3.2.1. Thank you, Ana Share this post Link to post Share on other sites
Swarnam Report post Posted June 8, 2012 Hi Ana, If your rendering the charts from a local machine, to enable communication between charts and JavaScript (like updating data, retrieving data, printing, exporting, event handling etc.), you need to setup Flash Player Global Security settings. For more information on "Flash Player Global Security settings", please refer the following link: http://docs.fusioncharts.com/charts/Tools/FlashPlayerSecuritySetup/HowToSetup.html#offline Hope this helps. Share this post Link to post Share on other sites
Ana Tag Report post Posted June 8, 2012 (edited) Hi Ana, If your rendering the charts from a local machine, to enable communication between charts and JavaScript (like updating data, retrieving data, printing, exporting, event handling etc.), you need to setup Flash Player Global Security settings. For more information on "Flash Player Global Security settings", please refer the following link: http://docs.fusionch...up.html#offline Hope this helps. Thank you Swarnam! Yes, I was testing it locally and the setting up Global Secruity settings did work. Also, I want to change sub-caption font size. I found on this site how to change it by using style tag in XML chart data but how can I acheive the samething using javascript? Thanks, Ana Edited June 8, 2012 by Ana Tag Share this post Link to post Share on other sites
Swarnam Report post Posted June 9, 2012 Hey Ana, Yes, font size for the sub caption can be changed by applying Font Style element. But, it will not be possible to change the sub-caption font size using JavaScript API like setChartAttribute method. Read more: http://docs.fusioncharts.com/charts/contents/JavaScript/JS_ChangeChartProperties.html Hope this helps. Share this post Link to post Share on other sites