D3 symbols
Earthquake demo for class #2
Hints for the homework assignment:
Hint #1: Combine "index.html" from this gist with the bar chart that we discussed in class.
Hint #2: Instead of the "data" array in the bar chart, [4, 8, 15, 16, 23, 42], you should use an array of data values (earthquake magnitudes) that you obtain from the USGS API.
Hint #3: The array of data values is actually the "feature" property of the data object that you get from the USGS API. You will need to work with this "data.feature" array to solve the homework.
Hint #4: Use the developer console to inspect things.
Solution to homework from Class #2
Assignment: Create a bar chart showing the number of earthquakes of magnitude [0 - 1), [1 - 2), [2 - 3), etc. Using data from the USGS real-time earthquake feed.
The idea is to combine what we learned about the USGS API with the bar chart from Mike Bostock's most excellent Let's Make a Bar Chart, the code for which is here. To help get you started, this demo shows how to access and inspect data from the USGS earthquake API.
Template for countries.
Template for US states.
Bravo to Philip for his block. This version is only slighly modified.
Changes:
- Cleaned up and documented a bit
- Used the one-month USGS feed.
There are two sections where you could consider working with the data (exercising the array methods discussed in class). I've indicated them with comments. For example, you could filter the earthquake data and/or the countries -- both are available as arrays. You should also try experimenting with the CSS, to change the styling of the map.
Slightly modified version of Suzee's block. Changes:
- plotQuakes & getQuakes are separate -- setTimeout calls plotQuakes
- window.setTimeout is inside getQuakes, where its argument is defined
- info message also indicates when the quakes are added
Changes to assignment #5. I believe this one does what you want. 3 changes are noted.
Various homework assignments for Fall 2015