Sign in to follow this  


Recommended Posts


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',


{ '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



Welcome to FusionCharts Forum!smile.gif


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

Share this post

Link to post
Share on other sites

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.



Edited by sudhanshu

Share this post

Link to post
Share on other sites



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:






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 :

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
Sign in to follow this