GithubHelp home page GithubHelp logo

rejane-b / data-journalism Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 5.75 MB

A scatter plot using D3 that represents each state with two of the data variables from data set US Census Bureau as rates of income, obesity, poverty, etc.

HTML 19.70% CSS 11.16% JavaScript 69.15%
scatter-plot risk-factors d3-dabbler data-journalism census-bureau data-visualization-position

data-journalism's Introduction

D3 - Data Journalism and D3

Newsroom

Background

The data set included is based on 2014 ACS 1-year estimates from the US Census Bureau, but you are free to investigate a different data set. The current data set includes data on rates of income, obesity, poverty, etc. by state. MOE stands for "margin of error."

Your Task

Core Assignment: D3 Dabbler (Required Assignment)

4-scatter

You need to create a scatter plot between two of the data variables such as Healthcare vs. Poverty or Smokers vs. Age.

Using the D3 techniques we taught you in class, create a scatter plot that represents each state with circle elements. You'll code this graphic in the app.js file of your homework directory—make sure you pull in the data from data.csv by using the d3.csv function. Your scatter plot should ultimately appear like the image at the top of this section.

  • Include state abbreviations in the circles.

  • Create and situate your axes and labels to the left and bottom of the chart.

  • Note: You'll need to use python -m http.server to run the visualization. This will host the page at localhost:8000 in your web browser.


Bonus: Impress the Boss

Why make a static graphic when D3 lets you interact with your data?

7-animated-scatter

1. More Data, More Dynamics

You're going to include more demographics and more risk factors. Place additional labels in your scatter plot and give them click events so that your users can decide which data to display. Animate the transitions for your circles' locations as well as the range of your axes. Do this for two risk factors for each axis. Or, for an extreme challenge, create three for each axis.

  • Hint: Try binding all of the CSV data to your circles. This will let you easily determine their x or y values when you click the labels.

2. Incorporate d3-tip

While the ticks on the axes allow us to infer approximate values for each circle, it's impossible to determine the true value without adding another layer of data. Enter tooltips: developers can implement these in their D3 graphics to reveal a specific element's data when the user hovers their cursor over the element. Add tooltips to your circles and display each tooltip with the data that the user has selected. Use the d3-tip.js plugin developed by Justin Palmer—we've already included this plugin in your assignment directory.

8-tooltip


Trilogy Education Services © 2019. All Rights Reserved.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.