copyx-accepted

by ryanttb

HTML

<script src="http://code.jquerygeo.com/jquery.geo-1.0.0-b1.5.js"></script>
<div id="map"></div>

CSS

#map {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

JavaScript

var offColor = "#999";
var onColor = "green";

// create a map with no services
// but set the shapeStyle option
var map = $("#map").geomap({
  zoom: 2,
  services: [],
  shapeStyle: {
    color: offColor,
    stroke: "#fff",
    strokeWidth: "2px",
    fillOpacity: 1
  }
});

// grab the world countires file
var countryCounts = {};
var country;
var i, j;
$.getJSON("http://data.jquerygeo.com/world-countries.json", function (result) {
    var countryMax = 0;
    
    for (i = 0; i < result.features.length; i++) {
        country = result.features[i];
        if (!(country.id in countryCounts)) {
            countryCounts[country.id] = {
                feature: country,
                count: 0
            };
        }
        
        for(j = 0; j < accepted.length; j++) {
            if (accepted[j].country == country.id) {
                countryCounts[country.id].count += 1;
                countryMax = Math.max(countryMax, countryCounts[country.id].count);
                break;
            }
        }
    }
    
    for (i = 0; i < result.features.length; i++) {
        country = result.features[i];
        if (countryCounts[country.id].count > 0) {
            map.geomap("append", country, {
                color: "rgb( 0, " + (128 + Math.floor( 127 * (countryCounts[country.id].count / countryMax) / 100 )) + ", 0)",
            }, false);
        } else {
          map.geomap("append", country, false);
        }
    }
    
    map.geomap("refresh");
});











var accepted = [
	{
		"id": "20",
		"country": "JEY",
		"microphone": "Yes",
		"webcam": "Yes",
		"language": "",
		"education": "Other",
		"gender": "Male",
		"occupation": "Artist/Developer",
		"harvardAlum": "No",
		"experienceOnline": "Some (Have started at least one course)",
		"heard": "edX email announcement",
		"statusReview": "First Rev",
		"statusAcceptance": "Yes"
	},
	{
		"id": "22",
		"country": "USA",
		"microphone": "Yes",
		"webcam": "Yes",
		"language": "",
		"education": "Some...