Skip to content

Instantly share code, notes, and snippets.

@subhajeet2107
Created March 20, 2020 07:01
Show Gist options
  • Save subhajeet2107/c50f62fc4cd89dc8f4537163f013d9b1 to your computer and use it in GitHub Desktop.
Save subhajeet2107/c50f62fc4cd89dc8f4537163f013d9b1 to your computer and use it in GitHub Desktop.
Geo Codes for India Geo Chart
India State Codes for Geo:
var data = google.visualization.arrayToDataTable([
['State Code', 'State', 'Result'],
['IN-AN','Andaman and Nicobar Islands',9],
['IN-AP','Andhra Pradesh',13],
['IN-AR','Arunachal Pradesh',34],
['IN-AS','Assam',13],
['IN-BR','Bihar',34],
['IN-CH','Chandigarh',15],
['IN-CT','Chhattisgarh',34],
['IN-DN','Dadra and Nagar Haveli',34],
['IN-DD','Daman and Diu',34],
['IN-DL','Delhi',34],
['IN-GA','Goa',76],
['IN-GJ','Gujarat',34],
['IN-HR','Haryana',14],
['IN-HP','Himachal Pradesh',34],
['IN-JK','Jammu and Kashmir',34],
['IN-JH','Jharkhand',34],
['IN-KA','Karnataka',34],
['IN-KL','Kerala',34],
['IN-LA','Ladakh',34],
['IN-LD','Lakshadweep',34],
['IN-MP','Madhya Pradesh',34],
['IN-MH','Maharashtra',34],
['IN-MN','Manipur',34],
['IN-ML','Meghalaya',34],
['IN-MZ','Mizoram',23],
['IN-NL','Nagaland',34],
['IN-OR','Odisha',34],
['IN-PY','Puducherry',34],
['IN-PB','Punjab',34],
['IN-RJ','Rajasthan',34],
['IN-SK','Sikkim',34],
['IN-TN','Tamil Nadu',34],
['IN-TG','Telangana',34],
['IN-TR','Tripura',34],
['IN-UP','Uttar Pradesh',34],
['IN-UT','Uttarakhand',34],
['IN-WB','West Bengal',54]]);
google.charts.load('current', {
'packages':['geochart'],
// Note: you will need to get a mapsApiKey for your project.
// See: https://developers.google.com/chart/interactive/docs/basic_load_libs#load-settings
'mapsApiKey': 'AIzaSyD-9tSrke72PouQMnMX-a7eZSW0jkFMBWY'
});
google.charts.setOnLoadCallback(drawRegionsMap);
function drawRegionsMap() {
var data = google.visualization.arrayToDataTable([
['State Code', 'State', 'Result'],
['IN-AN','Andaman and Nicobar Islands',9],
['IN-AP','Andhra Pradesh',13],
['IN-AR','Arunachal Pradesh',34],
['IN-AS','Assam',13],
['IN-BR','Bihar',34],
['IN-CH','Chandigarh',15],
['IN-CT','Chhattisgarh',34],
['IN-DN','Dadra and Nagar Haveli',34],
['IN-DD','Daman and Diu',34],
['IN-DL','Delhi',34],
['IN-GA','Goa',76],
['IN-GJ','Gujarat',34],
['IN-HR','Haryana',14],
['IN-HP','Himachal Pradesh',34],
['IN-JK','Jammu and Kashmir',34],
['IN-JH','Jharkhand',34],
['IN-KA','Karnataka',34],
['IN-KL','Kerala',34],
['IN-LA','Ladakh',34],
['IN-LD','Lakshadweep',34],
['IN-MP','Madhya Pradesh',34],
['IN-MH','Maharashtra',34],
['IN-MN','Manipur',34],
['IN-ML','Meghalaya',34],
['IN-MZ','Mizoram',23],
['IN-NL','Nagaland',34],
['IN-OR','Odisha',34],
['IN-PY','Puducherry',34],
['IN-PB','Punjab',34],
['IN-RJ','Rajasthan',34],
['IN-SK','Sikkim',34],
['IN-TN','Tamil Nadu',34],
['IN-TG','Telangana',34],
['IN-TR','Tripura',34],
['IN-UP','Uttar Pradesh',34],
['IN-UT','Uttarakhand',34],
['IN-WB','West Bengal',54]]);
var options = {
region:'IN',
resolution: 'provinces',
colorAxis: {colors: ['#ffeb3b', '#ff5722']}
};
var chart = new google.visualization.GeoChart(document.getElementById('geochart-colors'));
chart.draw(data, options);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment