gwofu

Members
  • Content count

    13
  • Joined

  • Last visited

About gwofu

  • Rank
    Junior Member
  1. Hi, The method setDataXML() was set to null after I clicked on USA map. Does FusionMaps or Flash provide a way to ignore mouse click? Thanks!
  2. 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; } },
  3. How to post code? Tried to post code but it was not shown.
  4. fusionChartUSA = { init : true, cc_init : function () { var data = this.getFusionChartUSADBData(); data = this.toFusionMapsData(data); this.load_fusioncharts(data); data = null; }, getFusionChartUSADBData : function () { // ... Get data from database and store it to holder. return holder }, 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(dashboard.root + "swf/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; } }, unload : function() { var mapObj = getMapFromId("map1Id"); mapObj = null; } } $(window).bind('unload', fusionChartUSA.unload); fusionChartUSA.cc_init();
  5. The target platform is Windows XP with browser IE7. Multiple Flash objects on the same page. I changed the code to create FusionMaps object only once then calling setDataXML() to update data for every 30 seconds. In this approach, the memory leak problem still exist but is much better. My app used to have Flash player crash within 12 hours, now it runs over 4 days. One problem I saw is after 4 days the USA map becomes invisible, the legend is visible and move mouse around can still see the state name and data. The other problem is the memory is increasing about 80MB a day. // Only called once. load_fusioncharts :function (data) { var map1 = new FusionMaps("FCMap_USA.swf", "map1Id", "300", "300", "0", "1"); map1.setDataXML(data); map1.render("map1div"); }, // update() is called for every 30 seconds. update : function(data) { var mapObj = getMapFromId("map1Id"); if (mapObj.setDataXML) { mapObj.setDataXML(data); data = null; } }, I wish FusionMaps team can find out what the problem is. Thanks!
  6. Thanks! My problem is solved.
  7. Set map_usa = null does not help.
  8. Hi, I use swfobject 2 to create a USA Map then try to update the map data by calling Flash methods SetVariable(), Rewind() and Play(). The result is the USA map becomes too big and only part of the map is displayed on the stage. Is it easy to fix it? Here is the code I use: var vars = "chart_id=mapusaid&path=script/&dataXML=" + data; //data : pre-build XML map data var att = {data:FCMap_USA.swf,width:300,height:300}; var swf_params = {allowScriptAccess: "always", flashvars:vars}; swf_params.wmode = "transparent"; var movie = swfobject.createSWF(att, swf_params, "map_usa"); ..... // Build new map XML to data movie.SetVariable('dataXML', data); movie.Rewind(); movie.Play(); // The map becomes too big here.
  9. Thanks, I will try null instead of undefined.
  10. Hi, Does FusionMaps.js have method to destroy a specific FusionMaps object? I couldn't find it. My page has many Flash objects, how do I release the memory for the FusionMaps I created. var map_usa = new FusionMaps("FCMap_USA.swf", "mapusaid", "100%", "100%", "0", "0"); My page runs 24/7 and this seems to cause memory problem when creating FusionMaps object every two minutes. Right now what I do is set map_usa to undefined before I create a new one. Appreciate for any input!
  11. Can anyone try this example under FusionMaps_TrialCodeJavaScriptChangeDataXML.html? Does it work? I want to know if I am the only one has this problem. Thanks!
  12. Hi, I just downloaded FusionMaps_Trial today and ran "FusionMaps_Trial/Code/JavaScript/ChangeDataXML.html" in Firefox 3 and IE 7 and both complain mapObj.setDataXML is not defined. Any idea? Thanks!
  13. Hi, I just downloaded FusionMaps_Trial today and ran "FusionMaps_Trial/Code/JavaScript/ChangeDataXML.html" in Firefox 3 and IE 7 and both complain mapObj.setDataXML is not defined. Regards,