Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added initial color of states with primaries on Super Tuesday.

  • Loading branch information...
commit 249197562b99c3bb93ed3472ad574ac524284446 1 parent 4e796fb
@schneidy authored
Showing with 14 additions and 3 deletions.
  1. +14 −3 SuperTuesdayTweets/js/init.js
View
17 SuperTuesdayTweets/js/init.js
@@ -1,3 +1,8 @@
+// Global information
+var primaryStates = ["Alaska", "Georgia", "Idaho", "Massachusetts",
+ "North Dakota", "Ohio", "Oklahoma", "Tennessee", "Vermont", "Virginia"];
+
+
$(document).ready(function() {
//Initial State map code from the D3 library "symbol-map" example.
@@ -19,8 +24,13 @@ $(document).ready(function() {
.data(collection.features)
.enter().append("path")
.attr("d", d3.geo.path().projection(xy))
- .attr("stateName", function(q) {return q.properties.name;})
- .attr("onclick", function(q) {return 'console.log("' + q.properties.name + '")';});
+ .attr("id", function(q) {return q.properties.name.split(' ').join('');})
+ .attr("onclick", function(q) {return 'console.log("' + q.properties.name + '")';})
+ .style("fill", function(q) {
+ if(window.primaryStates.indexOf(q.properties.name) != -1){
+ return "red";
+ }
+ });
});
@@ -38,4 +48,5 @@ $(document).ready(function() {
.delay(function(d, i) { return i * 50; })
.attr("r", function(d) { return r(d.properties.population); });
});*/
-});
+});
+
Please sign in to comment.
Something went wrong with that request. Please try again.