Skip to content
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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

cindyd02
Copy link
Collaborator

No description provided.

Copy link
Collaborator

@juliaWoelmer juliaWoelmer left a 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>
Copy link
Collaborator

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) {
Copy link
Collaborator

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)));
Copy link
Collaborator

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)
Copy link
Collaborator

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;
}

Copy link
Collaborator

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)
Copy link
Collaborator

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) {
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants