Sign in to follow this  
Max95

Javascript-links dosen't work

Recommended Posts

Hello everyone,

 

I have a little problem with Javascript Link, when I click on a chart.

 

I just copied the sourcecode-exemple from the website:

<html>
  <head>
    <title>JavaScript Link Example</title>
    <script language="JavaScript" src="Javascript/Charts/FusionCharts.js"></script>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
    <SCRIPT LANGUAGE="JavaScript"><!--
      function myJS(myVar){
           $("#test").append("<br>" +myVar);
      }
    // --></SCRIPT>
  </head>
  <body bgcolor="#ffffff">
    
    <div id="chartdiv" align="center">The chart will appear within this DIV. This text will be replaced by the chart.</div>
    
    <script type="text/javascript"><!--
        var myChart = new FusionCharts("Javascript/Charts/Column2D.swf", 
        "myChartId", "500", "300", "1", 
        "1");
       myChart.setXMLUrl("Data_Chart.xml");
       myChart.render("chartdiv");
    // --></script>
    
    <div id="test" style="margin-left: 0px;">


    </div>

  </body>
</html>

 my XML-Data:

<chart caption='ABC Bank Branches' subCaption='(In 
      Asian Countries)' yaxislabel='Branches' xaxislabel='Country' unescapeLinks='0'>
    <set label='Hong Kong' value='235' link="JavaScript:myJS('Hong Kong,235');"/> 
    <set label='Japan' value='123' link="JavaScript:myJS('Japan, 123');"/>
    <set label='Singapore' value='129' link="JavaScript:myJS('Singapore, 129');"/> 
    <set label='Malaysia' value='121' link="JavaScript:myJS('Malaysia, 121');"/> 
    <set label='Taiwan' value='110' link="JavaScript:myJS('Taiwan, 110');"/> 
    <set label='China' value='90' link="JavaScript:myJS('China, 90');"/> 
    <set label='S. Korea' value='86' link="JavaScript:myJS('S.Korea, 86');"/> 
</chart>

when I click on the chart nothing happens.

Does somebody has an Idea?

 

Thanks for help

Max95

 

Share this post


Link to post
Share on other sites
Guest Rishab

Hi,

Please try rendering your chart using a server to resolve the issue.

Many browsers restrict JavaScript from accessing local file system owing to security reasons.

Share this post


Link to post
Share on other sites

Hi,

 

I have checked the URL you have provided, and it seems that the variable "dataString" that you have used for passing data to your map using setXMLData() is not declared anywhere and does not hold any data.

 

You have used " map.setXMLData( dataString ); " but the variable dataString does not hold anything. Please pass some data to the map to view the map. 

 

Ref. 

 map.setXMLData( "<map />");

 

Hope this helps.

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