Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
0ed6b55
gitignore
karhodes173 Mar 10, 2021
a63424b
Final Project Init
karhodes173 Mar 10, 2021
1afb2f7
Updated project structure for the final project by creating a contain…
karhodes173 Mar 10, 2021
7984090
added data for national statistics
pjmara Mar 13, 2021
2a430b9
working 3 vis
pjmara Mar 16, 2021
710114f
moving visual into react component
lafernandes22 Mar 16, 2021
6b34d25
Verified loading viz animation
karhodes173 Mar 16, 2021
0875bbf
case study viz
resallie Mar 16, 2021
b7629a6
Merge pull request #1 from resallie/casestudy
lafernandes22 Mar 17, 2021
80fa4c3
Integrated IndustryEffects with React
karhodes173 Mar 17, 2021
494d3b1
the data
resallie Mar 17, 2021
9e5751e
Merge pull request #2 from resallie/casestudy
lafernandes22 Mar 17, 2021
97e908a
starting to work through integration
lafernandes22 Mar 17, 2021
be3dd2c
Merge pull request #3 from karoad/USALaborStats
lafernandes22 Mar 17, 2021
d3af7a2
static map loading
lafernandes22 Mar 17, 2021
f1f6b6b
Integrate
karhodes173 Mar 17, 2021
9ebd6d4
Merge pull request #4 from karoad/resturauntsCS
karoad Mar 17, 2021
1ba15fc
working static map
lafernandes22 Mar 17, 2021
1f95b99
USAMap&IndustryUpdates
karhodes173 Mar 18, 2021
600e521
vis complete
lafernandes22 Mar 18, 2021
d693b52
Merge branch 'main' into USAmap
karoad Mar 18, 2021
7ce493c
Merge pull request #5 from karoad/USAmap
karoad Mar 18, 2021
2539557
complete visual and writeup
lafernandes22 Mar 18, 2021
4e2d295
fix merge issue
lafernandes22 Mar 18, 2021
753158b
Fix Viz Styling for Final and RestrauntCaseStudy
karhodes173 Mar 18, 2021
d677bf5
Merge branch 'main' into USAmap
karoad Mar 18, 2021
dd1ccfc
Merge pull request #6 from karoad/USAmap
karoad Mar 18, 2021
b890344
Fixed some scrolling buggyness
karhodes173 Mar 18, 2021
69eba14
updated readme, just need youtube video link
pjmara Mar 18, 2021
22619f7
Merge branch 'main' of github.com:karoad/final into main
pjmara Mar 18, 2021
907c548
Add files via upload
lafernandes22 Mar 18, 2021
f487c94
adding readme and project book
pjmara Mar 18, 2021
c39feca
Merge branch 'main' of github.com:karoad/final into main
pjmara Mar 18, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
Binary file added CS480X Final Project Book.pdf
Binary file not shown.
Binary file added CS480x Screen Cast.mp4
Binary file not shown.
120 changes: 18 additions & 102 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,115 +1,31 @@
Final Project - Interactive Data Visualization
===

The key learning experience of this course is the final project.
You will design a web site and interactive visualizations that answer questions you have or provide an exploratory interface to some topic of your own choosing.
You will acquire the data, design your visualizations, implement them, and critically evaluate the results.
[Link to our vis](https://final-dataviz.herokuapp.com/project5)
[Link to our screencast](https://www.youtube.com/watch?v=reC60_Ei_AE&ab_channel=LucasFernandes)
[Link to process book](https://docs.google.com/document/d/1resK3vFESY57gr2kFaUK3E77DgP7YR-QjTMAjZ27uE0/edit?usp=sharing)

The path to a good visualization is going to involve mistakes and wrong turns.
It is therefore important to recognize that mistakes are valuable in finding the path to a solution, to broadly explore the design space, and to iterate designs to improve possible solutions.
To help you explore the design space, we will hold events such as feedback sessions in which you propose your idea and initial designs and receive feedback from the class and staff.
**Explanation of features:**
For Labor statistics:
- Highlighting a line will show the year as text above the vis
- Choose the vis you want to look at from the dropdown above the vis
- The text below the vis updates depending on which vis you have selected

Proposal
---

Submit project proposals using [this Google Form](https://docs.google.com/forms/d/e/1FAIpQLSc9DFlcClPArC1RKNFsXzfJfauZA57ksU85kT0hX2OEEDlxqw/viewform?usp=sf_link).
You may submit more than one proposal.
1-3 folks per team.

Final Project Materials
---
For your final project you must hand in the following items.

### Process Book

An important part of your project is your process book. Your process book details your steps in developing your solution, including the alternative designs you tried, and the insights you got. Develop your process book out of the project proposal. Equally important to your final results is how you got there! Your process book is the place you describe and document the space of possibilities you explored at each step of your project. It is not, however, a journal or lab notebook that describes every detail - you should think carefully about the important decisions you made and insights you gained and present your reasoning in a concise way.

We strongly advise you to include many figures in your process book, including photos of your sketches of potential designs, screen shots from different visualization tools you explored, inspirations of visualizations you found online, etc. Several images illustrating changes in your design or focus over time will be far more informative than text describing those changes. Instead, use text to describe the rationale behind the evolution of your project.

Your process book should include the following topics. Depending on your project type the amount of discussion you devote to each of them will vary:
For Case Study:
The independent restaurant case study visualization contains an interactive map. Users can pan around and zoom in and out of the map. Additionally, dots cover the map representing restaurants. The user can click a dot to generate two bar graphs representing the sales and the number of meals served in the restaurant. The bars will animate from their old position to the new one. The clicked restaurant dot will turn red, so the user can visually identify which restaurant they currently have selected. Upon hovering over unselected restaurant dots, the color will become darker and the restaurant's name will appear in a tooltip. The space above the bar graphs will contain the currently selected restaurant's name, city and state.

- Overview and Motivation: Provide an overview of the project goals and the motivation for it. Consider that this will be read by people who did not see your project proposal.
- Related Work: Anything that inspired you, such as a paper, a web site, visualizations we discussed in class, etc.
- Questions: What questions are you trying to answer? How did these questions evolve over the course of the project? What new questions did you consider in the course of your analysis?
- Data: Source, scraping method, cleanup, etc.
- Exploratory Data Analysis: What visualizations did you use to initially look at your data? What insights did you gain? How did these insights inform your design?
- Design Evolution: What are the different visualizations you considered? Justify the design decisions you made using the perceptual and design principles you learned in the course. Did you deviate from your proposal?
- Implementation: Describe the intent and functionality of the interactive visualizations you implemented. Provide clear and well-referenced images showing the key design and interaction elements.
- Evaluation: What did you learn about the data by using your visualizations? How did you answer your questions? How well does your visualization work, and how could you further improve it?
For Seated Diners Choropleth Map:
The dropdown allows the users to select the date of the first of the month starting May 1st 2020, and then everyday in March 2021. Selecting a date will highlight the maps a color corresponding to how many of the seated diners in that state were accepting reservations that day.

As this will be your only chance to describe your project in detail make sure that your process book is a standalone document that fully describes your results and the final design.
[Here](http://dataviscourse.net/2015/assets/process_books/bansal_cao_hou.pdf) are a [few examples](http://dataviscourse.net/2015/assets/process_books/walsh_trevino_bett.pdf) of process books from a similar course final.

### Project Website
Our code is mostly our own, and what we did not come up with ourselves is referenced below

You will create a public website for your project using GitHub pages or any other web hosting service of your choice.
The web site should contain your interactive visualization, summarize the main results of the project, and tell a story.
Consider your audience (the site should be public public) and keep the level of discussion at the appropriate level.
Your process book and data should be linked from the web site as well.
Also embed your interactive visualization and your screen-cast in your website.
If you are not able to publish your work (e.g., due to confidential data) please let us know in your project proposal.

### Project Screen-Cast

Each team will create a two minute screen-cast with narration showing a demo of your visualization and/or some slides.
You can use any screencast tool of your choice, such as Camtasia.
Please make sure that the sound quality of your video is good - it may be worthwhile to invest in an external USB microphone.
Upload the video to an online video-platform such as YouTube or Vimeo and embed it into your project web page.
We will show some of the best videos in class.

We will strictly enforce the two minute time limit for the video, so please make sure you are not running longer.
Use principles of good storytelling and presentations to get your key points across. Focus the majority of your screencast on your main contributions rather than on technical details.
What do you feel is the best part of your project?
What insights did you gain?
What is the single most important thing you would like your audience to take away? Make sure it is front and center rather than at the end.

Outside Libraries/References
**References and Libraries utilized**
---

For this project you *do not* have to write everything from scratch.

You may *reference* demo programs from books or the web, and *include* popular web libraries like Bootstrap, JQuery, Backbone, React, Meteor, etcetera.

Please *do not* use libraries on top of d3, however. Libraries like nvd3.js look tempting, but such libraries often have poor defaults and result in poor visualizations.
Instead, draw from the numerous existing d3 examples on the web.

If you use outside sources please provide a References section with links at the end of your Readme.
- [Gradient legend](https://bl.ocks.org/HarryStevens/6eb89487fc99ad016723b901cbd57fde)
- [Professor Harrison's code for making maps in d3](https://wpi0-my.sharepoint.com/:u:/g/personal/ltharrison_wpi_edu/ESyRc5olk4FDsk9bdV7VDVsBCUCRoTbzyPnZ7zipJC2t0w?e=rkzWgs)
- [Creating color palettes](https://coolors.co/gradient-palette/d5ded9-11c411?number=5)
- [source reference for labor chart](https://www.d3-graph-gallery.com/graph/line_basic.html)

Resources
---
The "[Data is Plural](https://tinyletter.com/data-is-plural/archive)" weekly letter often contains interesting datasets.

Think of something you're interested in, go find data on it! Include data processing as part of your work on this project.

Requirements
---

Store the following in your GitHub repository:

- Code - All web site files and libraries assuming they are not too big to include
- Data - Include all the data that you used in your project. If the data is too large for github store it on a cloud storage provider, such as Dropbox or Yousendit.
- Process Book- Your Process Book in PDF format.
- README - The README file must give an overview of what you are handing in: which parts are your code, which parts are libraries, and so on. The README must contain URLs to your project websites and screencast videos. The README must also explain any non-obvious features of your interface.

GitHub Details
---

- Fork the repo. You now have a copy associated with your username.
- Make changes to index.html to fulfill the project requirements.
- Make sure your "master" branch matches your "gh-pages" branch. See the GitHub Guides referenced above if you need help.
- Edit the README.md with a link to your gh-pages or other external site: for example http://YourUsernameGoesHere.github.io/DataVisFinal/index.html
- To submit, make a [Pull Request](https://help.github.com/articles/using-pull-requests/) on the original repository.

Grading
---

- Process Book - Are you following a design process that is well documented in your process book?
- Solution - Is your visualization effective in answering your intended questions? Was it designed following visualization principles?
- Implementation - What is the quality of your implementation? Is it appropriately polished, robust, and reliable?
- Presentation - Are your web site and screencast clear, engaging, and effective?
Your individual project score will also be influenced by your peer evaluations.

References
---

- This final project is adapted from https://www.dataviscourse.net/2020/project/
Binary file added img/cleveland-bar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/cleveland-equation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/cleveland-results.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/cleveland-table.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
235 changes: 235 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,235 @@
<script src="https://d3js.org/d3.v6.min.js"></script>
<svg id="frame"></svg>

<style>
</style>

<body>
<select id="selectButton"></select>
</body>

<script>


var listCsv = ["./data/TotalDiningEmployees.csv", "./data/UnemploymentData.csv", "./data/USAWEeklyAverageHours.csv"];
var listPromises = []
for (var i = 0; i < listCsv.length; i++)
{
const promise = new Promise((resolve, reject) => {
resolve(d3.csv(listCsv[i]));
});
listPromises.push(promise);
}

var width = 540;
var height = 300;
var minIncome = 1;


var margin = {top: 10, right: 30, bottom: 30, left: 60};
width = width - margin.left - margin.right,
height = height - margin.top - margin.bottom;

//setup body area and axis
var scatterSvg = d3.select("body").append("svg")
.attr("id", "scatterPlot")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("transform",
"translate(" + margin.left + "," + margin.top + ")");

var xscaleScatter = d3.scaleLinear()
.domain([1, 12])
.range([0, width]);

var xAxis = scatterSvg.append("g")
.attr("transform", "translate(0," + height + ")")
.call(d3.axisBottom(xscaleScatter));

var yscaleScatterTotalEmployees = d3.scaleLinear()
.domain([6000,13000])
.range([height, 0]);

var yscaleScatterUnemployment = d3.scaleLinear()
.domain([1, 35])
.range([height, 0]);

var yscaleScatterHoursWorked = d3.scaleLinear()
.domain([20, 27])
.range([height, 0]);
var yAxis = scatterSvg.append("g")
.call(d3.axisLeft(yscaleScatterTotalEmployees));

var totalEmployeesData;
var totalEmployeesLine;
var unemploymentData;
var unemploymentLine;
var avgWeeklyHours;
var avgWeeklyHoursLine;

Promise.all(listPromises).then((values) => {
totalEmployeesData = separateData(values[0]);
totalEmployeesLine = createLineData(values[0]);
unemploymentData = separateData(values[1]);
unemploymentLine = createLineData(values[1]);
avgWeeklyHours = separateData(values[2]);
avgWeeklyHoursLine = createLineData(values[2]);

//onsole.log(totalEmployeesData);
//console.log(totalEmployeesLine);
//console.log(unemploymentData);
//console.log(avgWeeklyHours);

//console.log(totalEmployeesData.columns);

//idea: line chart that is highlightable on mouseover,
//overlaid years selectable by years
//also points that bring up the value and maybe a tooltip with a comment?

//example 1: Total Employees data
//start with the data points, should be all overlaid


var allGroup = ["Total Employees", "Unemployment", "Average Weekly Hours"];

// add the options to the button
d3.select("#selectButton")
.selectAll('myOptions')
.data(allGroup)
.enter()
.append('option')
.text(function (d) { return d; }) // text showed in the menu
.attr("value", function (d) { return d; });


updatePoints(totalEmployeesData, totalEmployeesLine, xscaleScatter, yscaleScatterTotalEmployees);





});

function updatePoints(data, line, xscaleScatter, yscaleScatter) {
//data points
scatterSvg.selectAll("circle").remove();
scatterSvg
.selectAll("dot")
.data(data)
.enter()
.append("circle")
.attr("id", function(d,i) { return "scatter"+ d[4]})
.attr('cx', function(d, i){
//depends on the month
return xscaleScatter(d[1]);
})
.attr('cy', function(d){
//depends on the actual val
return yscaleScatter(d[2]);
})
.attr("r", 3)
.style("fill", "#FFFFFF")
.style("opacity", function(d){return 1;})
.attr("stroke", "black")
.attr("stroke-width", function(d){
return 1;
})
.on('mouseover', function(mouseEvent, val) {
//display datapoint info somewhere
d3.select(this).attr('stroke-width', 2).attr('stroke', 'black');
})
.on('mouseout', function(mouseEvent, val) {
//consider undoing the above
d3.select(this).attr('stroke-width', 1).attr('stroke', 'black');
});

scatterSvg.selectAll("path").remove();
//credit https://www.d3-graph-gallery.com/graph/line_basic.html
for (var i = 0; i < line.length; i++) {
var lineGenerator = d3.line();
var lineData = []
var currRow = line[i][1];
var currYear = line[i][0];
for (var j = 0; j < line[i][1].length; j++) {
lineData.push([xscaleScatter(currRow[j][0]), yscaleScatter(currRow[j][1])]);
}
var pathData = lineGenerator(lineData);
scatterSvg.append("path")
//.transition()
//.duration(1000)
.attr("d", pathData)
.attr("stroke", "black")
.attr("stroke", "gray")
.attr("stroke-width", 3)
.style("opacity", function(d){return 0.7;})
.attr("fill", "none")
.on('mouseover', function(mouseEvent, val) {
//display datapoint info somewhere
d3.select(this).attr('stroke-width', 7).attr('stroke', 'steelblue').style("opacity", function(d){return 1;});
})
.on('mouseout', function(mouseEvent, val) {
//consider undoing the above
d3.select(this).attr('stroke-width', 3).attr('stroke', 'gray').style("opacity", function(d){return 0.7;});
});
}
}

d3.select("#selectButton").on("change", function(d) {
// recover the option that has been chosen
var selectedOption = d3.select(this).property("value")
// run the updateChart function with this selected option
if (selectedOption == "Total Employees"){ yAxis.call(d3.axisLeft(yscaleScatterTotalEmployees)); updatePoints(totalEmployeesData, totalEmployeesLine, xscaleScatter, yscaleScatterTotalEmployees); }
else if (selectedOption == "Unemployment") {yAxis.call(d3.axisLeft(yscaleScatterUnemployment)); updatePoints(unemploymentData, unemploymentLine, xscaleScatter, yscaleScatterUnemployment);}
else { yAxis.call(d3.axisLeft(yscaleScatterHoursWorked)); updatePoints(avgWeeklyHours, avgWeeklyHoursLine, xscaleScatter, yscaleScatterHoursWorked);}
}); // corresponding value returned by the button

function separateData(dataIn) {
//function separates the data in format:
//Each row is a year
//each col is a month
//each cell is a val
//and changes it into:
//everything is one row
//each index is [year, month, val]
var listOfEverything = [];
for (var i = 0; i < dataIn.length; i ++) {
var year = dataIn[i]["Year"];
count = 1;
for (var key in dataIn[i]) {
if (parseInt(dataIn[i][key]) != NaN && dataIn[i][key] != "" && key != "Year") {
listOfEverything.push([year, count, parseInt(dataIn[i][key])]);
count += 1;
}
}
}
return listOfEverything;
}

function createLineData(dataIn) {
//function separates the data in format:
//Each row is a year
//each col is a month
//each cell is a val
//and changes it into:
//each year is a row
//each index is [month, val]
var listOfEverything = [];
for (var i = 0; i < dataIn.length; i ++) {
var year = dataIn[i]["Year"];
var listYear = [];
count = 1;
for (var key in dataIn[i]) {
if (parseInt(dataIn[i][key]) != NaN && dataIn[i][key] != "" && key != "Year") {
listYear.push([count, parseInt(dataIn[i][key])]);
count += 1;
}
}
listOfEverything.push([year, listYear]);
}
return listOfEverything;
}



</script>
3 changes: 3 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading