Skip to content

Commit

Permalink
I added comments for the functions I was familiar with
Browse files Browse the repository at this point in the history
  • Loading branch information
stevemac1900 committed Aug 7, 2015
1 parent 7a02699 commit 0c8524e
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions gradientUSMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,22 @@ function GradientMap(feature){
// .attr("id", "comboDiv" + this.id.toString());

//this.makeCombo();


// Creates the map div
this.mapDiv = d3.select("#mapContainer")
.append("div")
.attr("id", "mapSVG" + this.id.toString())
.attr("class", this.columnWidth)
.style("width", this.w.toString() + "px")
//.style("height", this.h.toString() + "px");
.style("margin", "0" + newThis.columnMargin);


// Appends an svg with the map controls/gradient to the div
this.grad_svg = this.mapDiv.append("svg")
.attr("width", this.svgScaler * 800)
.attr("height", 40);


// Checks to see if the zoom function is compatible with the web browser being used
if(this.canZoom){

this.svg = this.mapDiv.append("svg")
Expand All @@ -110,7 +113,7 @@ function GradientMap(feature){
.append("g");

} else {

// Appends an svg to the div for us to put a map into
this.svg = this.mapDiv.append("svg")
.attr("style", "border: thin solid gray; border-radius: 5px;")
.attr("width", this.w)
Expand All @@ -119,7 +122,7 @@ function GradientMap(feature){
.append("g");

}

d3.select("#mapContainer")
.append("div")
.attr("id", "tooltip" + this.id.toString())
Expand All @@ -128,9 +131,10 @@ function GradientMap(feature){
return this;

};


// This function resets the map to its original scale and position
this.reset = function(){

this.zoom.scale(1);
this.zoom.translate([0, 0]);
this.svg.transition().duration(0).
Expand Down Expand Up @@ -310,6 +314,7 @@ function GradientMap(feature){
}

})
// Apply these attributes to this map object
.on("click", newThis.linkWithObservers)
.on("mouseover", newThis.mouseOver)
.on("mouseout", newThis.mouseOut)
Expand Down Expand Up @@ -459,9 +464,8 @@ function GradientMap(feature){
this.rest_of_filename = new_name;
return this;
};

this.drawBoxes = function(boxNum){

this.drawBoxes = function(boxNum){

var colorArray = makeRange(boxNum, newThis.start_color, newThis.end_color);
newThis.grad_svg.selectAll(".rectangle").remove();
Expand Down Expand Up @@ -685,7 +689,9 @@ function GradientMap(feature){
});

};


// This function computes the geometric center of each state based on the furthest points of the country/state
// rather than the center of mass
this.computeCenter = function(data){

var nums = [];
Expand Down Expand Up @@ -854,6 +860,7 @@ function GradientMap(feature){
return "#ccc";
}
})
// Apply these attributes to this map object
.style("stroke-width", "1")
.style("stroke", "black")
.on("click", newThis.clickWithObservers)
Expand Down

0 comments on commit 0c8524e

Please sign in to comment.