Sign in to follow this  
gwofu

setDataXML was set to null after clicked on USA map

Recommended Posts

Hi,

 

 

 

I am using FCMap_USA.swf, calling setDataXML() to update data every 30 seconds.

 

Once I clicked on the map the map1.setDataXML was set to null.

 

 

 

 

 

I was not able to post the code for whole html page, so I put the part that is related to FusionMaps.

 

 

 

toFusionMapsData : function (holder)

 

{

 

var colorMap = ['FF0000', 'FF8080', 'FFA040', '40B266', '00FF00', '80FF80'];

 

var stateCounts = $(window).data('stateCounts');

 

var stateCountsSize = stateCounts.length;

 

var sectionSize = parseInt(stateCountsSize/(colorMap.length));

 

var preV = 0, tmpV;

 

var dvs = [];

 

var index = 0;

 

var legend = "";

 

 

 

if (stateCountsSize <= colorMap.length)

 

{

 

for (var i=0; i

 

{

 

legend = legend.concat("");

 

}

 

legend = legend.concat("");

 

}

 

else

 

{

 

for (var i=0; i

 

{

 

tmpV = parseInt(i/sectionSize);

 

if (preV != tmpV)

 

{

 

dvs[index] = stateCounts[i - 1];

 

index++;

 

preV = tmpV;

 

}

 

}

 

 

 

// legend

 

var dvl = dvs.length - 1;

 

 

 

for (var i=0; i

 

{

 

legend = legend.concat("");

 

}

 

legend = legend.concat("");

 

}

 

 

 

var data = "";

 

for (var x in holder)

 

{

 

data = data.concat("");

 

}

 

data = data.concat("");

 

return "" + legend + data;

 

},

 

 

 

load_fusioncharts :function (data)

 

{

 

var w = Math.round($(window).width() / 2);

 

var h = Math.round($(window).height() / 3);

 

 

 

var map1 = new FusionMaps("FCMap_USA.swf", "map1Id", w, h, "0", "1");

 

map1.setDataXML(data);

 

map1.render("map1div");

 

},

 

 

 

update : function()

 

{

 

var mapObj = getMapFromId("map1Id");

 

$('#mapObj').width('100%').height('100%');

 

if (mapObj.setDataXML)

 

{

 

var data = this.getFusionChartUSADBData();

 

data = this.toFusionMapsData(data);

 

mapObj.setDataXML(data);

 

data = null;

 

}

 

},

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