Google GeoChart not working with Malaysia Map -
im trying display figures using geochart malaysia map, working fine, if display in world map. when drill malaysia map, geochart can't display value state.
did miss out something?
<html> <head> <script type='text/javascript' src='https://www.google.com/jsapi'></script> <script type='text/javascript'> google.load('visualization', '1', {'packages': ['geochart']}); google.setonloadcallback(drawmarkersmap); function drawmarkersmap() { var data = google.visualization.arraytodatatable([ ['state', 'data'], ['kedah', 5], ]); var options = { region: 'my', displaymode: 'regions', resolution: 'provinces', }; var chart = new google.visualization.geochart(document.getelementbyid('chart_div')); chart.draw(data, options); }; </script> </head> <body> <div id="chart_div" style="width: 900px; height: 500px;"></div> </body> </html>
i not familiar enough names of provinces of malaysia know how google render them, able color provinces of malaysia following code:
function drawvisualization() { var data = new google.visualization.datatable(); data.addcolumn('string', 'state'); data.addcolumn('number', 'data'); data.addrows([ [{v:'my-14', f:' wilayah persekutuan kuala lumpur'}, 42], [{v:'my-15', f:' wilayah persekutuan labuan'}, 57], [{v:'my-16', f:' wilayah persekutuan putrajaya'}, 38], [{v:'my-01', f:' johor'}, 82], [{v:'my-02', f:' kedah'}, 46], [{v:'my-03', f:' kelantan'}, 51], [{v:'my-04', f:' melaka'}, 72], [{v:'my-05', f:' negeri sembilan'}, 16], [{v:'my-06', f:' pahang'}, 2], [{v:'my-08', f:' perak'}, 87], [{v:'my-09', f:' perlis'}, 29], [{v:'my-07', f:' pulau pinang'}, 49], [{v:'my-12', f:' sabah'}, 26], [{v:'my-13', f:' sarawak'}, 94], [{v:'my-10', f:' selangor'}, 35], [{v:'my-11', f:' terengganu'}, 79], ]); var options = { region: 'my', displaymode: 'regions', resolution: 'provinces', height: 600, width: 800, }; var geochart = new google.visualization.geochart( document.getelementbyid('visualization')); geochart.draw(data, options); }
whenever using google geocharts on province level, use iso-3166 alpha-2 province codes country since work, , use {value: 'iso 3166 alpha-2 code', format: 'human readable province name'}
trick display properly.
Comments
Post a Comment