Sign in to follow this  
cvh

External Url From Chart, Using Json

Recommended Posts

Hello all. I'm trying to reach an external URL by clicking on a bar in a chart but nothing happens.

 

I've read the LinkFormat documentation which indicates all we need is something along the lines of link="http://www.fusioncharts.com" , but cannot get it to work.

 

Here is my code - any ideas, please? Thank you.

 

<html><head><meta charset="utf-8"><title></title><script type="text/javascript" src="../charts/FusionCharts.js"></script></head><body><div id="chartContainer" style="width:100%; height:100%;">Chart should load here!</div><script type="text/javascript">var myChart = new FusionCharts("../charts/Column2D.swf", "myChartId", "100%", "100%", "0", "1"); myChart.setJSONData([{
   "chart": {
       "caption": "Subscriber numbers",
       "xaxisname": "Channel",
       "yaxisname": "Subscribers"
   },
   "data": [
       {
           "label": "BBC",
           "value": "37800",
           "link": "http://news.bbc.co.uk"
       },
       {
           "label": "CBS",
           "value": "21900",
           "link": "http://www.cbsnews.com"
       },
       {
           "label": "SKY",
           "value": "32900",
           "link": "http://news.sky.com"
       },
       {
           "label": "FOX",
           "value": "39800",
           "link": "http://www.foxnews.com"
       }
   ]
}]);myChart.render("chartContainer");</script></body></html>

 

 

Share this post


Link to post
Share on other sites
Guest Bindhu

Hello all. I'm trying to reach an external URL by clicking on a bar in a chart but nothing happens.

 

I've read the LinkFormat documentation which indicates all we need is something along the lines of link="http://www.fusioncharts.com" , but cannot get it to work.

 

Here is my code - any ideas, please? Thank you.

 

<html><head><meta charset="utf-8"><title></title><script type="text/javascript" src="../charts/FusionCharts.js"></script></head><body><div id="chartContainer" style="width:100%; height:100%;">Chart should load here!</div><script type="text/javascript">var myChart = new FusionCharts("../charts/Column2D.swf", "myChartId", "100%", "100%", "0", "1"); myChart.setJSONData([{
   "chart": {
       "caption": "Subscriber numbers",
       "xaxisname": "Channel",
       "yaxisname": "Subscribers"
   },
   "data": [
       {
           "label": "BBC",
           "value": "37800",
           "link": "http://news.bbc.co.uk"
       },
       {
           "label": "CBS",
           "value": "21900",
           "link": "http://www.cbsnews.com"
       },
       {
           "label": "SKY",
           "value": "32900",
           "link": "http://news.sky.com"
       },
       {
           "label": "FOX",
           "value": "39800",
           "link": "http://www.foxnews.com"
       }
   ]
}]);myChart.render("chartContainer");</script></body></html>

 

 

 

Hi,

 

Please remove the enclosing square brackets for the JSON data.

 

Ref. Code:

myChart.setJSONData({   "chart": {    	"caption": "Subscriber numbers",    	"xaxisname": "Channel", .........});

 

After rendering the chart, when i clicked on the data plot, I was able to see BBC NEWS web page.

 

Please note: You should run it from the server.

 

Flash Player's Global Security implementation blocks JavaScript to interact with charts (Flash charts) when you are running the the web page or application with charts from local file system. To configure Flash Player Global Security Settings (to enable links and chart APIs) and enable JavaScript calls from charts, you will need to add the folder containing the chart SWF files to Flash Player's Trusted Zone.

 

Please refer to the link below,

http://docs.fusioncharts.com/charts/Tools/FlashPlayerSecuritySetup/HowToSetup.html

 

Hope this helps!

 

Share this post


Link to post
Share on other sites

That worked perfectly, thank you!

 

For anyone else running into the issue - I had to use Firefox rather than Chrome to get to the Adobe Flash Settings Manager. Right-click the bar on the chart and you should see a Global Settings menu - click that and you'll be sent to an Adobe website which embeds the Settings Manager for your machine. I added my charts folder (containing all the FusionCharts .swf files) into the location which instructs Flash to 'always trust files in these locations'.

 

I am running Ubuntu 12.04, Firefox 14.0.1 and Adobe Flash 11.2.202.236

Edited by cvh

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