Sign in to follow this  
pizichen

Click invalid using fusionMaps

Recommended Posts

Hi Team,

    I have a worry long problem. I using fusionMaps realizes some function. But when I click a state in the map, the custom JavaScript function not execute. Please help me.

 

Thank You.

 

Here is the html code.

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script language="javascript" src="FusionCharts.js"></script>
<title>my map</title>
<script language="JavaScript">
function myJS(myVar){
  window.alert(myVar);
}

function setMap(){
 var map = new FusionCharts('FCMap_China2.swf', "Map1Id", "800", "540", "0", "0");
map.setDataXML("<map showShadow='0' showBevel='1' showMarkerLabels='1'  borderColor='00324A' fillColor='F0FAFF' hoverColor='C0D2F8' baseFont='Verdana' baseFontSize='12' markerBorderColor='000000' markerBgColor='FF5904' markerRadius='6' legendPosition='bottom' useHoverColor='1' showMarkerToolTip='1' showCanvasBorder='1' canvasBorderColor='f1f1f1' canvasBorderThickness='2' borderColor='00324A'  hoverColor='C0D2F8'>       <data>   <entity id='CN.AH' displayValue='安徽' toolText='安徽,53台AC' color='FF0000'  link='JavaScript:myJS(\"安徽\");'/><entity id='CN.SH' displayValue='上海' toolText='上海,53台AC' color='FF0000'  link='JavaScript:myJS(\"上海\");'/> </data>  </map>");
    map.render("mapDiv");
}
</script>
</head>
<body onload="setMap()">
<div id="mapDiv" align="center" style="margin:2px;">Test Map</div>
</body>
</html>

Share this post


Link to post
Share on other sites

Hi Team,

    I have a worry long problem. I using fusionMaps realizes some function. But when I click a state in the map, the custom JavaScript function not execute. Please help me.

 

Thank You.

 

Here is the html code.

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<script language="javascript" src="FusionCharts.js"></script>

<title>my map</title>

<script language="JavaScript">

function myJS(myVar){

  window.alert(myVar);

}

function setMap(){

 var map = new FusionCharts('FCMap_China2.swf', "Map1Id", "800", "540", "0", "0");

map.setDataXML("<map showShadow='0' showBevel='1' showMarkerLabels='1'  borderColor='00324A' fillColor='F0FAFF' hoverColor='C0D2F8' baseFont='Verdana' baseFontSize='12' markerBorderColor='000000' markerBgColor='FF5904' markerRadius='6' legendPosition='bottom' useHoverColor='1' showMarkerToolTip='1' showCanvasBorder='1' canvasBorderColor='f1f1f1' canvasBorderThickness='2' borderColor='00324A'  hoverColor='C0D2F8'>       <data>   <entity id='CN.AH' displayValue='安徽' toolText='安徽,53台AC' color='FF0000'  link='JavaScript:myJS(\"安徽\");'/><entity id='CN.SH' displayValue='上海' toolText='上海,53台AC' color='FF0000'  link='JavaScript:myJS(\"上海\");'/> </data>  </map>");

    map.render("mapDiv");

}

</script>

</head>

<body onload="setMap()">

<div id="mapDiv" align="center" style="margin:2px;">Test Map</div>

</body>

</html>

Hi,

 

Could you please confirm if you are rendering Flash Map?

 

In case yes, please note that the Flash Player Global Security settings needs to be enabled, if you are running the application from local file system (C:\ or D:\) and not from web server (local or live).

 
Flash Player's Global Security setting blocks invoking/calling JavaScript from SWF (Flash Movie) by default. So you need to reset your setting into Global Security Setting panel and enable it while using Drill-down functions and various other JavaScript related functions.
 
Please refer to the following page for further details on the Flash Player Global Security settings:
 
Also, please make sure the Internal ID of the entities are correct in the XML and corresponds to the Map Specification sheet.
 
Hope this helps. :)

Share this post


Link to post
Share on other sites

Dear admin:

    Thank you very mush. I according to your method, when I set Flash Player's Global Security, the javascript funtion can works, I'm so happy.

 

    Now, only a question. When I click the state, alert characters incorrect. Look at this picture.

 

problem.jpg

Share this post


Link to post
Share on other sites

Hi,

 

We are looking into your query about Flash variant of China map and will get back to you soon.

 

Meanwhile, could you please try using the JavaScript variant and let us know if it works fine? For converting the current chart to JavaScript chart, you just include the following line before the chart rendering.

 

Ref. 

 

FusionCharts.setCurrentRenderer('JavaScript');

 
Also, you have used the attributes "borderColor" and "hoverColor" twice in your XML. Please use each attribute just once.
 
Hope this helps

Share this post


Link to post
Share on other sites

Hi,

 

The problem of incorrect characters in the alert can be resolved by using the attribute "unescapeLinks" and setting it to 0.

 

Internally the chart decodes a URL that you set as link. Before invoking the link it again encodes the URL. If you are passing multilingual characters via a URL ,you do not want this decode-encode mechanism to be handled by chart. In such case, you can use this attribute and set it to 0.

 

Eg. <chart .. unescapeLinks='0' >

 

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