sudhanshu Report post Posted July 18, 2011 Hi, I am using json to build chart. I want to call a JavaScript function when I click on a linked chart . Please tell me what is the syntax or a piece of example code to do that. My chart is {'chart':{'caption':'IT Spend Effectiveness','xaxisname':'Geography','yaxisname':'uptime','unescapeLinks' : '0' },' bgColor':'DFE8F6', 'canvasBgColor':'DFE8F6', 'data':[ { 'label':'Americas ','value':'142.512077294686','link':'JavaScript-alert(Hi)' }, { 'label':'Asia ','value':'142.512077294686','link':'JavaScript-alert('Hi')' }, , { 'label':'Europe ','value':'142.512077294686','link':'JavaScript-alert-Hi;' }] }. When I am clicking on the bars it's showing error. Thanks for your reply in advance. Share this post Link to post Share on other sites
Guest Angshu Report post Posted July 18, 2011 Hi, Welcome to FusionCharts Forum! Please find the sample code below: { "chart": { "caption" : "Weekly Sales Summary" , "xAxisName" : "Week", "yAxisName" : "Sales", "numberPrefix" : "{:content:}quot; }, "data" : [ { "label" : "Week 1", "value" : "14400", "link" :"JavaScript: isJavaScriptCall=true; alert('hi JS!'); myJS('USA',235);"}, { "label" : "Week 2", "value" : "19600" }, { "label" : "Week 3", "value" : "24000" }, { "label" : "Week 4", "value" : "15700" } ] } More Details at:http://www.fusioncha.../Drilldown.html Hope this helps. Share this post Link to post Share on other sites
sudhanshu Report post Posted July 18, 2011 (edited) Thanks for your input Angshu But this piece of code is not working. I already have tried this earlier. Is there anyway we can try this using j-myJavaScriptFunction-parameters kind of notation. Thanks Edited July 18, 2011 by sudhanshu Share this post Link to post Share on other sites
FusionCharts Support Report post Posted July 26, 2011 Hi, The format is very simple. All you would need to do is to use link property of the data. The format is either of these two: J-jsFunctionName-parameterAsString or JavaScript:javascript code You seem to have mixed both of these:JavaScript-alert(Hi). This is invald. Again, you can not pass Hi without putting it inside a quote or apostrophe to pass it as string. Presently it would be taken as a variable name. JavaScript rules! But, additionally, if you are running it from local file system you would need to set up Flash Player global security settings. Check out this post for more information : http://forum.fusioncharts.com/topic/10016-flash-player-103-global-security-settings/page__pid__39164#entry39164 Share this post Link to post Share on other sites
FusionCharts Support Report post Posted July 26, 2011 Format: J-jsFunctionName-parameterAsString can only be used to pass the name of the function and parameter to the function after dash. Note that the parameter will always be passed as one single string to the function. Share this post Link to post Share on other sites