Basic CSS practice to style the HTML page with headlines, byline, body text, and images in an external style sheet.
Country | 2013 | 2010 | 2005 | 2000 | 1995 | 1990 | Change in Mortality Rate (1990-2013) | |
---|---|---|---|---|---|---|---|---|
Afghanistan | 400 | 500 | 730 | 1100 | 1200 | 1200 | -0.666666667 | |
Albania | 21 | 21 | 24 | 28 | 29 | 31 | -0.322580645 | |
Algeria | 89 | 92 | 100 | 120 | 140 | 160 | -0.44375 | |
Angola | 460 | 530 | 750 | 1100 | 1400 | 1400 | -0.671428571 | |
Argentina | 69 | 76 | 70 | 63 | 60 | 71 | -0.028169014 | |
Armenia | 29 | 31 | 37 | 43 | 51 | 47 | -0.382978723 | |
Australia | 6 | 5 | 6 | 9 | 8 | 7 | -0.142857143 | |
Austria | 4 | 3 | 5 | 5 | 7 | 10 | -0.6 | |
Azerbaijan | 26 | 27 | 36 | 57 | 83 | 60 | -0.566666667 |
<html> | |
<head> | |
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'> | |
<title>Highcharts Extract Example</title> | |
<!-- Code example for class extracted from http://datatools.urban.org/Features/wealth-inequality-charts/ with code from Tim Meko and Ben Chartoff --> | |
<style> | |
body { |
Read in data for the Maternal Mortality Rates in the World with d3.js. Logs the data in the console. This gist was not done in the real D3 'way.' This uses a JS loop that will add p elements for each item in the data set manually instead of using enter().
d3.csv("maternalMortalityRate.csv", function (mydata) {
//Everything involving the dataset should go here.
Assigment:
- fix any column names you think should/could be improved in the csv (and give it a new name)
- load your data in d3 using d3.csv, and in the function in d3.csv:
- add a property to the data set in javascript that is the sum of the years' values for each
- add a property to the data set in javascript that is the difference between 2010 and 2013
- sort the data by the new value that is the sum of the refugees
- draw your
's for each row of the fixed data set, using the sort order for sum of refugees (largest at the top)
Binded data by following Scott Murray's chapter on binding data
Used vLookup and an external table with country and regions to match country by regions. Sorted the table by region. Styled the table to match the UNICEF brandtoolkit colors.
Sorted the data by region:
myData.sort(function(a, b){
return d3.ascending(a.region, b.region);
A table of Maternal Mortality Rates sorted by Region. The differences between 1990 and 2013 is highlighted with a color scale. The lighter the color, the larger the decrease in the mortality rate in the particular country.
This week we focused on the concept of scales in D3.
The color scale that I used:
var colorScale = d3.scale.linear()
.domain(d3.extent(allDifferences))
We were given a file with random SVGs. Assignment:
- Using d3 to select all the ellipses, re-style all the ellipses so their fill is blue.
- Using d3 to select all the rectangles, re-style them so their stroke width is 2px instead.
- Use d3 to style all the rectangles so they are pink.
- Then use d3 to style the first rectangle so it is blue.
- Use d3 to select the rectangle with id svg_2 and make the color of the stroke orange.
- Use a CSS style to set the background color of the SVG to a light gray.