Skip to content

Instantly share code, notes, and snippets.

@sunnyuxuan
sunnyuxuan / index.html
Last active January 24, 2016 04:34
This statistic depicts the amount of chocolate consumed per person in 2011, by country. In that year, each citizen of the United States consumed about 4.6 kilograms of chocolate.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Week1 homework chocolate data</title>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js"></script>
<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
</head>
<body>
Country Year2011 Year2013
United States 1% 1.50%
OECD 0.50% 1.00%
Year < 1 Year 1-5 Years 6-10 Years 11-17 Years 18-34 Years 35-49 Years 50-64 Years 65 +
1995 1.7 4.1 3.4 13.2 28.8 24.4 19.3 5.2
1999 1.3 3.4 2.8 9.2 25.2 27.3 21.9 9
2003 1.4 2.6 1.7 8.1 26 26.6 24.9 8.9
2007 1.5 2.3 1.5 6.1 26.4 26.2 26.4 9.5
2011 1.4 2.8 1.4 5.3 27.6 26.7 27.6 7.3
2015 1.7 2.8 1.4 4.4 30 25.8 27.4 6.6
<!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>
THis is a sortable table
@sunnyuxuan
sunnyuxuan / Week4 homework.readme
Created February 8, 2016 05:27
Week4 homework1
Make a table like the one in d3_table_heatmap.html for your data. You can modify your existing table if you want. It should be sortable using stupidtable.js. Make a color scale for one of your numeric columns. You can use the scale on a font or the background.
@sunnyuxuan
sunnyuxuan / index.html
Created February 8, 2016 05:34
Week4 homework2
<html lang="en">
<head>
<meta charset="utf-8">
<title>SVG Shapes</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
@sunnyuxuan
sunnyuxuan / Week4 homework3.readme
Last active February 8, 2016 21:04
week4 homework3
Using the model in d3_dynamic_domain.html, make your own barchart for your own data. Pick one of your numeric columns, and resize the SVG container to fit it. You can adjust range etc. as you like. Add text to the page saying what it is showing.
@sunnyuxuan
sunnyuxuan / Week5 in class.readme
Last active February 10, 2016 03:50
Week5 In Class
better life data scatter plot
Using the bar chart you made already, add a margin (using a margin object) to fix up your bar chart. Use an ordinal axis on the Y axis. Add an X axis label, and special color rule for your barchart (change one of the bars, or bars below or above mean/median to a different color). Also, label the end points of your bars with their actual values (see the SVG Text section of the notes above for tips). Add a hover rule to your CSS, so when the mouse is over the bar, it changes color a little.