Doomhammer

Updating entity attributes with Javascript

Recommended Posts

Hi.

 

 

 

I'm looking for the best way to solve this:

 

 

 

I've got a map of europe, and all its countries. I want to click on a country and update the corresponding with a new background color. Is there a good, clean way of doing this?

 

 

 

Right now I've had to set the XML of the map to a javascript variable, pass that in, on click use a regular expression to find the entity in the XML and replace the color attribute with a new one, then set the entire XML back to fusionmaps using setDataXML. This is a slow and error prone way of doing it.

 

 

 

What I'd so like to see in FusionMaps would be true integration with the data, such as...

 


function entityClickCallback(entity) {

 if(entity.getAttribute('color') == '#ff00ff') {

   entity.setAttribute('color', '#bf1942');

 }

}

 

 

 

I don't know if that sort of interaction between javascript and actionscript is possible (entity would have to be an object with functions), but boy would it be awesome.

 

 

 

Thanks,

 

Doomhammer.

Share this post


Link to post
Share on other sites

Hi Doomhammer

 

I recently started working with fusionMaps, would it be possible for you to share your code as an example on how to change the color of a entity.

 

I was able to get a clickEvent by using javaScript.

 

Hi.

 

 

 

I'm looking for the best way to solve this:

 

 

 

I've got a map of europe, and all its countries. I want to click on a country and update the corresponding with a new background color. Is there a good, clean way of doing this?

 

 

 

Right now I've had to set the XML of the map to a javascript variable, pass that in, on click use a regular expression to find the entity in the XML and replace the color attribute with a new one, then set the entire XML back to fusionmaps using setDataXML. This is a slow and error prone way of doing it.

 

 

 

What I'd so like to see in FusionMaps would be true integration with the data, such as...

 


function entityClickCallback(entity) {

 if(entity.getAttribute('color') == '#ff00ff') {

   entity.setAttribute('color', '#bf1942');

 }

}

 

 

 

I don't know if that sort of interaction between javascript and actionscript is possible (entity would have to be an object with functions), but boy would it be awesome.

 

 

 

Thanks,

 

Doomhammer.

Share this post


Link to post
Share on other sites
Guest Angie

Hi,

 

Welcome to FusionCharts Forum!smile.gif

 

First of all, we would like to thank you for showing interest in FusionCharts.

 

Please find a sample workaround for your reference.

 

Hope this helps.smile.gif

HighlightEnitityOnClick2.zip

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