-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cindy dong assignment 6 #50
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just small comments. Overall, I think your code would be a lot cleaner if you split things up into functions a bit more, but that's my only overall comment.
<label for="state">Sort By State</label> | ||
<br> | ||
<input type="radio" id="emissions-desc" name="sort" value="emissions-desc"> | ||
<label for="emissions-desc">Sort By Emissions Descending</label> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love your use of labels with the input here and the "for" specifications. Really makes it clear to read and is great from an accessibility standpoint
@@ -21,11 +22,138 @@ function createChart(elementId) { | |||
.append('g') | |||
.attr('class', 'svg-group') | |||
.attr('transform', 'translate(' + margins.left + ',' + margins.top + ')'); | |||
// read in air quality data | |||
d3.csv('air_quality.csv').then(function(data) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can get rid of the "function(data)" here and replace it with "(data) =>." Same with your other uses of similar syntax below
// legend for regions | ||
const legend = svg.append("g") | ||
.attr("transform", `translate(${margins.left + 120},${margins.top})`); | ||
const regions = Array.from(new Set(data.map(d => d.Region))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Love the use of map and Set here
|
||
g.select('.x.axis') | ||
.transition() | ||
.duration(1500) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add a delay to the transition for the axis as well so that the bars and the axis move together
alert("Please enter a number for the delay"); | ||
return; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can get rid of the empty space here. It isn't needed
|
||
// transition bars | ||
bars.transition() | ||
.duration(1500) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remember to indent all the lines from 139 to 143 here just to be consistent with the styling in the rest of the file
loc: [+d.longitude, +d.latitude] | ||
}; | ||
}).then(function (loadedStations) { | ||
stations = loadedStations; | ||
draw(geoJSONStates, stations); | ||
}); | ||
}); | ||
|
||
function draw(geoJson, stations) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would name the stations variable in this function something different in order to differentiate it from the other stations variable declared on line 20
No description provided.