Search the Community
Showing results for tags 'llisteners'.
Found 1 result
-
Hi, Am trying to work through the events tutorial because that is what we need and I have a problem and can't seem to get it. Using your tutorial here http://www.fusioncharts.com/dev/map-guide/listening-to-map-events.htmlmy world map works fine. Teh box in the bottom shows the population of the continent on mouseover When I use a map of a continent I get null where the population should be. IN other words when I mouseover a country I get "Population nullM" instead of a number. In addition the coutinent shows uniform blue. SO I must be doing something wrong, but the only thing I change is the map name, and the two letter codes. You can see the scripts on the bottom. Even tried it with your numeircal code instead of country code, but no good. I am mystified. Any help you can give is appreciated. GOOD CODE <script> FusionCharts.ready(function() { var populationMap = new FusionCharts({ type: 'maps/world', renderAt: 'mapdiv', width: '600', height: '400', dataFormat: 'json', dataSource: { "chart": { "caption": "Global Population", "theme": "fint", "formatNumberScale": "0", "numberSuffix": "M", "showLabels": "1", "showToolTip": "0" }, "colorrange": { "color": [{ "minvalue": "0", "maxvalue": "100", "code": "#D0DFA3", "displayValue": "< 100M" }, { "minvalue": "100", "maxvalue": "500", "code": "#B0BF92", "displayValue": "100-500M" }, { "minvalue": "500", "maxvalue": "1000", "code": "#91AF64", "displayValue": "500M-1B" }, { "minvalue": "1000", "maxvalue": "5000", "code": "#A9FF8D", "displayValue": "> 1B" }] }, "data": [{ "id": "NA", "value": "515" }, { "id": "SA", "value": "373" }, { "id": "AS", "value": "3875" }, { "id": "EU", "value": "727" }, { "id": "AF", "value": "885" }, { "id": "AU", "value": "32" }], }, "events": { "entityRollover": function(evt, data) { document.getElementById('message').value = "" + data.label + "\n" + "Population: " + data.value + "M"; }, "entityRollout": function(evt, data) { document.getElementById('message').value = "Total World Population - 6.3 Billion"; }, "entityClick": function(evt, data) { alert("You have clicked on " + data.label + "."); }, } }).render(); }); </script> BAD CODE <script> FusionCharts.ready(function() { var populationMap = new FusionCharts({ type: 'maps/africa', renderAt: 'mapdiv', width: '600', height: '400', dataFormat: 'json', dataSource: { "chart": { "caption": "Africa Population", "theme": "fint", "formatNumberScale": "0", "numberSuffix": "M", "showLabels": "1", "showToolTip": "0" }, "colorrange": { "color": [{ "minvalue": "0", "maxvalue": "100", "code": "#D0DFA3", "displayValue": "< 100M" }, { "minvalue": "100", "maxvalue": "500", "code": "#B0BF92", "displayValue": "100-500M" }, { "minvalue": "500", "maxvalue": "1000", "code": "#91AF64", "displayValue": "500M-1B" }, { "minvalue": "1000", "maxvalue": "5000", "code": "#A9FF8D", "displayValue": "> 1B" }] }, "data": [{ "id": "ZA", "value": "515" }, { "id": "EG", "value": "373" }, { "id": "BW", "value": "3875" }, { "id": "BJ", "value": "727" }, { "id": "KE", "value": "885" }, { "id": "DZ", "value": "32" }], }, "events": { "entityRollover": function(evt, data) { document.getElementById('message').value = "" + data.label + "\n" + "Population: " + data.value + "M"; }, "entityRollout": function(evt, data) { document.getElementById('message').value = "Total World Population - 6.3 Billion"; }, "entityClick": function(evt, data) { alert("You have clicked on " + data.label + "."); }, } }).render(); }); </script>