|
<!DOCTYPE html> |
|
<html lang="en"> |
|
<head> |
|
<meta charset="utf-8"> |
|
<title>Week3 homework</title> |
|
<link rel="stylesheet" href="style.css"> |
|
</head> |
|
<body> |
|
|
|
<h1 style="color:#007fff; text-align: center;">TOP 10 Places of Origin of International Students</h1> |
|
|
|
<p>According to the Open Doors International Student data portal, <strong style="color:#007fff;">974,926</strong> |
|
international students studied at U.S. colleges and universities in 2014-2015. Among these international students, <strong style="color:#007fff;">58%</strong> of them are come from China, India, South Korea and Saudi Arabia.</p> |
|
|
|
<div id="table" style=" |
|
margin: auto;"> </div> |
|
|
|
<p style="color:grey;">Source: Institute of International Education. (2001). "Leading Places of Origin of International Students, 2013-2014." Open Doors Report on International Educational Exchange. Retrieved from http://www.iie.org/opendoors</p> |
|
</body> |
|
|
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js"></script> |
|
<script type="text/javascript" src="tabulate.js"></script> |
|
|
|
<script type="text/javascript"> |
|
|
|
|
|
|
|
d3.csv("week3.csv", function(error, data) { |
|
if (error) { |
|
console.log("Loading file has errors."); |
|
} |
|
|
|
|
|
data.forEach(function(d, i){ |
|
d.Percent = d.Year2014 / d.Total ; |
|
d.Percent = d.Percent * 100; |
|
d.Percent = d3.round(d.Percent,1); |
|
}); |
|
|
|
data.sort(function(a,b){ |
|
return +b.Percent - +a.Percent |
|
}); |
|
|
|
|
|
console.log(data); |
|
var regionTable = tabulate(data, |
|
["Place of Origin", "Year2013", "Year2014", "Percent"], |
|
"#table"); |
|
|
|
}); |
|
|
|
</script> |
|
|
|
</html> |