FusionCharts Forum: Get entity values on map click - FusionCharts Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Get entity values on map click

#1 User is offline   pariyani 

  • Junior Member
  • PipPip
  • Group: Members
  • Posts: 11
  • Joined: 28-April 10

Posted 16 July 2010 - 03:27 PM

Hi,



Is there a way to get entity values (including short name, long name, id) by clicking on a map entity using javascript?



For example,

Lets say I click on the State of Texas on a US map and an alert box pops up saying "You clicked on Texas (TX) , Value='1234', entity ID='TX'."



I am sure this is easy but I couldn't find a solution in the forums. Can someone please help with this or point to a link where a similar query is addressed?



*update: The DB Schema does not have Long Names stored for any entity so that is not an option.*



Thanks.
MYP
0

Other Replies To This Topic

#2 User is offline   Basundhara Ghosal 

  • Supreme Being
  • PipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 2459
  • Joined: 15-September 09

Posted 19 July 2010 - 02:46 AM

Hi,

In this case you need to use your own code in javascript so that it returns the entity values.

Ref.- 
<set label='USA' value='235' link="j-myJS-NA,235"/>

<SCRIPT LANGUAGE="JavaScript">
<!--
function myJS(myVar){
 window.alert(myVar);
}
//-->
 </SCRIPT>

Hope this helps.

Regards,

Basundhara Ghosal

Follow us on Twitter :D
0

Other Replies To This Topic

#3 User is offline   pariyani 

  • Junior Member
  • PipPip
  • Group: Members
  • Posts: 11
  • Joined: 28-April 10

Posted 19 July 2010 - 10:22 AM

Hey,



Thanks for the Code, but that was not what I was asking for. I specifically wanted to pull out long and short names of a map entity from the map object itself.



Anyways, I found the solution. The code is as follows:



In the chart XML:

<entity id='123' value='500' link='j-getEntityData-123'/>





//javascript Code

function getEntityData(id) {

var map1 = getMapFromId("mapid");

var entities = map1.getEntityList();//

var lName = "";

var sName = "";

for (i = 1; i < entities.length; i++) {

if (entities[i].id == id)

lName= entities[i].lName; sName= entities[i].sName;

}

alert("Long Name: "+ lName +", Short Name: "+sName);

}



Please let me know if there is a better solution than this.





Thanks.
MYP
0

Other Replies To This Topic

#4 User is offline   Basundhara Ghosal 

  • Supreme Being
  • PipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 2459
  • Joined: 15-September 09

Posted 20 July 2010 - 12:43 AM

Hi,

We are glad that your issue is resolved.

Thanks for sharing your idea.

Keep smiling and keep FusionCharting. :)

Regards,

Basundhara Ghosal

Follow us on Twitter :D
0

Other Replies To This Topic

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic