Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
d88eb6d
Add files via upload
Termite1 Feb 26, 2024
9ba2e22
Original
shivalimani Feb 27, 2024
51d863c
Deleted Files
shivalimani Feb 27, 2024
2b7aba0
Create layout.html
shivalimani Feb 27, 2024
f1c6c22
Add files via upload
Termite1 Feb 27, 2024
3d88947
Update layout.html
shivalimani Feb 27, 2024
a63ff67
Merge branch 'main' of https://github.com/shivalimani/Final-Project-C…
shivalimani Feb 27, 2024
ee8d929
Create vBeeswarm.js
Termite1 Feb 27, 2024
fef34a3
Render chart on page
Feb 27, 2024
e2a86da
Color selection and editing axis for comparisons
Feb 27, 2024
eff9da5
Create filtering_data.js
Termite1 Feb 28, 2024
5773407
Merge branch 'main' into as
Feb 28, 2024
a03e3ef
Add files via upload
Termite1 Feb 28, 2024
2128e01
Merge branch 'main' into as
Feb 28, 2024
226aaba
Create protest_demand_colors.txt
nkuchipudi2020 Feb 28, 2024
5f66e3b
Load data
Feb 28, 2024
457272a
Merge branch 'main' into as
Feb 28, 2024
86db8ec
Updated colors, added filtering
Feb 28, 2024
597d306
Merge pull request #1 from shivalimani/as
AndrewSalls Feb 28, 2024
0ead420
Add files via upload
Termite1 Feb 29, 2024
8d6971f
Create tooltip_code.js
Termite1 Feb 29, 2024
6c80a36
Update tooltip_code.js with protester violence
Termite1 Feb 29, 2024
49a6699
Has code for tooltip
Termite1 Feb 29, 2024
0ce8832
Added references to README.md
Termite1 Feb 29, 2024
812d30c
Updated colors for light theme
nkuchipudi2020 Feb 29, 2024
ce339ef
Delete reduced_protest_dataV2.csv
Termite1 Feb 29, 2024
cd9e231
Removed entries without a listed state response
Termite1 Feb 29, 2024
6c836fb
Added information panel and protester demand filter
nkuchipudi2020 Feb 29, 2024
ff6bb2c
Merge branch 'main' of https://github.com/shivalimani/Final-Project-C…
nkuchipudi2020 Feb 29, 2024
7f98d20
Added legend
nkuchipudi2020 Feb 29, 2024
cdb7ede
Visual tweaks
Feb 29, 2024
c6c5dd5
Create tooltip_plugin.js
Termite1 Feb 29, 2024
17acffe
Added state response filter
nkuchipudi2020 Feb 29, 2024
97a0186
Merge branch 'main' of https://github.com/shivalimani/Final-Project-C…
nkuchipudi2020 Feb 29, 2024
055c1f9
Updated vBeeswarm
Feb 29, 2024
d585214
Merge branch 'main' into as
Feb 29, 2024
1139b0a
Merge progress
Feb 29, 2024
e1075e2
Fixed typo
nkuchipudi2020 Feb 29, 2024
35af915
Render tooltips
Feb 29, 2024
e7e2f64
Merge branch 'main' into as
Feb 29, 2024
ae0d1f1
Timeline & layout
Feb 29, 2024
4b1c303
Merge pull request #2 from shivalimani/as
AndrewSalls Feb 29, 2024
5cbc582
Region filter and color change based on region
nkuchipudi2020 Feb 29, 2024
713a571
Slight scale tweaks
Feb 29, 2024
3e99634
Merge branch 'main' into as
Feb 29, 2024
a3c5e83
Create dummy
Termite1 Feb 29, 2024
9f537d1
Delete Code Samples/dummy
Termite1 Feb 29, 2024
05b1c79
Rename tooltip_code.js to Code Samples/tooltip_code.js
Termite1 Feb 29, 2024
024aa18
Rename Mirrored_Beeswarm.tgz to Code Samples/Mirrored_Beeswarm.tgz
Termite1 Feb 29, 2024
d1b1128
Rename filtering_data.js to Code Samples/filtering_data.js
Termite1 Feb 29, 2024
c704833
Rename vBeeswarm.js to Previous Versions/vBeeswarm.js
Termite1 Feb 29, 2024
127405f
Rename reduced_protest_data.csv to Previous Versions/reduced_protest_…
Termite1 Feb 29, 2024
292b643
Rename protest_demand_colors.txt to Code Samples/protest_demand_color…
Termite1 Feb 29, 2024
0a092c6
Rename protest_data.csv to Previous Versions/protest_data.csv
Termite1 Feb 29, 2024
31b2d6a
Added Oceania
nkuchipudi2020 Feb 29, 2024
92be303
Merge branch 'main' of https://github.com/shivalimani/Final-Project-C…
nkuchipudi2020 Feb 29, 2024
b19a780
Cleaning formatting
Mar 1, 2024
6ce076a
Merge branch 'main' into as
Mar 1, 2024
d9a8c6f
Update README.md
Termite1 Mar 1, 2024
32e4bed
Full tooltip positioning fix
Mar 1, 2024
f59015b
Merge branch 'main' into as
Mar 1, 2024
d9d8d7f
Merge pull request #3 from shivalimani/as
Mar 1, 2024
77bf2cb
Update for gh-pages compatability
Mar 1, 2024
59ca5eb
process book and readme
shivalimani Mar 1, 2024
c9d5a2f
Update README.md
shivalimani Mar 1, 2024
d5e2abc
Update README.md
nkuchipudi2020 Mar 1, 2024
a751f01
Update README.md
shivalimani Mar 1, 2024
8c8996f
Update README.md
shivalimani Mar 1, 2024
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
Binary file added Code Samples/Mirrored_Beeswarm.tgz
Binary file not shown.
37 changes: 37 additions & 0 deletions Code Samples/filtering_data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
//For fixed filter
const filteredData = flare.filter(d => d.region === "MENA");

//For dynamic filter attached to dropdown menu

/* HTML for dropdown menu creation, add before java script
<select id="violenceDropdown">
<option value="All">All</option>
<option value="1">Protester Violence</option>
<option value="0">No Violence</option>
</select>
*/

function updateChart(selectViolence) {
const filteredData = selectViolence === 'All' ? flare : flare.filter(d => d.protesterviolence === selectViolence);

// Remove previous instances of the chart
svg.selectAll('g').remove();

// Add all chart creation code here, except the code to create the SVG. That must be done before the updateChart function

};

// Initial Chart Render
updateChart('All');

// Event listener for dropdown change
d3.select('#violenceDropdown')
.on('change', function() {
const selectViolence = this.value;
updateChart(selectViolence);
});

// Chart return at end
return svg.node();
}
7 changes: 7 additions & 0 deletions Code Samples/protest_demand_colors.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Political Behavior, Process #8A3FFC
Land Farm Issue #33B1FF
Police Brutality #007D79
Price Increases, Tax Policy #FF7EB6
Labor Wage Dispute #FA4D56
Removal of Politician #FFF1F1
Social Restrictions #6FDC8C
25 changes: 25 additions & 0 deletions Code Samples/tooltip_code.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//Code for tooltip generation is imported. I couln't make it work with my own code
import {Plot} from "@mkfreeman/plot-tooltip";

// Add this as an attribute to the Plot function, like y:, sort:, or title:. Tooltip isn't perfect, but it works
title: (d) => `${d.region} \n ${d.country}, ${d.location} \n ${d.startdate} - ${d.enddate} \n ${d.participants} ${d.protesteridentity}` + violenceTooltip(d.protesterviolence) + `\n Protestor Demand 1: ${d.protesterdemand1}` + toolBuild(d.protesterdemand2, `Protestor Demand 2:`) + toolBuild(d.protesterdemand3, `Protestor Demand 3:`) + toolBuild(d.protesterdemand4, `Protestor Demand 4:`) + `\n State Response 1: ${d.stateresponse1}` + toolBuild(d.stateresponse2, `State Response 2:`) + toolBuild(d.stateresponse3, `State Response 3:`) + toolBuild(d.stateresponse4, `State Response 4:`) + toolBuild(d.stateresponse5, `State Response 5:`) + toolBuild(d.stateresponse6, `State Response 6:`) + toolBuild(d.stateresponse7, `State Response 7:`)

// Function helps build conditional tooltip
toolBuild = (val, valTitle) => {
if (val == "") {
return ""
}
else {
return `\n ${valTitle} ${val}`
}
}

// Function for protester violence
violenceTooltip = (val) => {
if (val == 0){
return `\n No Violence`
}
else if (val == 1){
return `\n Protester Violence`
}
}
1 change: 1 addition & 0 deletions Previous Versions/protest_data.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions Previous Versions/reduced_protest_data.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

102 changes: 102 additions & 0 deletions Previous Versions/vBeeswarm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
function colorMap(d) {
// Replace with actual column
switch(d["region"]) {
case "North America":
return "#6929c4";
case "South America":
return "#1192e8";
case "Europe":
return "#005d5d"
case "Central America":
return "#9f1853";
case "Africa":
return "#fa4d56";
case "MENA":
return "#570408";
case "Asia":
return "#198038";
default:
console.log(d["region"]);
return "#000000";
}
};

let flare;

// Add any other variables for filters here
let selectViolence = "All";
let selectProtestDemand = "All";
let selectStateResponse = "All";

window.onload = async () => {
flare = await d3.csv("./reduced_protest_data.csv");

// For other filters, copy this and change variable and select tag to match the HTML for the new filter
d3.select('#violenceDropdown')
.on('change', function() {
selectViolence = this.value;
updateChart();
});

d3.select('#protestdemandDropdown')
.on('change', function() {
selectProtestDemand = this.value;
updateChart();
});

d3.select('#stateresponseDropdown')
.on('change', function() {
selectStateResponse = this.value;
updateChart();
});

updateChart("All");
}

function updateChart() {
const plot = Plot.plot({
width: 3000,
height: 900,
y: {line: true, ticks: 0, label: null, axis: "left"},
marks: [

Plot.dotY(flare, Plot.dodgeX({
y: flare.map(d => parseFloat(d["endfrac"])),
sort: "endfrac",
r: flare.map(d => (d["participantsizeindicator"] / 2) + 1),
title: "name",
fill: flare.map(d => colorMap(d)),
filter: (d => {
// Example of how to add new filters:
// if(d["region"] !=== regionVar) {
// return null;
// }

// Violence or not
if(selectViolence === "All" && selectProtestDemand === "All" && selectStateResponse === "All") {
return d;
}

const violenceMatch = selectViolence === "All" || d["protesterviolence"] === selectViolence;

// Check if the data point matches the protest demand filter
const demandMatch = selectProtestDemand === "All" || d["protesterdemand1"] === selectProtestDemand;

const stateResponseMatch = selectStateResponse === "All" || d["stateresponse1"] === selectStateResponse;

// Include the data point if it matches both filters
return violenceMatch && demandMatch && stateResponseMatch? d : null;
})
}))
]
});

const displayDiv = document.querySelector("#chart-display");
const divWrapper = document.createElement("div");
divWrapper.className = "left-chart";

divWrapper.append(plot);

displayDiv.innerHTML = "";
displayDiv.append(divWrapper);
}
122 changes: 17 additions & 105 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,125 +1,37 @@
Final Project - Interactive Data Visualization
Final Project - Timeline of Global Protest
===

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, provide an exploratory interface to some topic of your own choosing, or take on a more ambitious experiment than A3.
You will acquire the data, design your visualizations, implement them, and critically evaluate the results.
A dynamic beeswarm graph to showcase the timeline of protests around the world.

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.

Proposals / Idea Generation
Project Features
---

Submit project ideas using [this Google Form](https://docs.google.com/forms/d/e/1FAIpQLSc72vId8keotkEvLrB9Ef3Nt0e1uh_-mWmQ5okyPM5_q2a89Q/viewform?usp=sf_link).
All the code used to create the visualization is present in the main Github page, layout.html being the html code that implements that visualization, the code v2Beeswarm.js and tooltip_plugin.js generating the graphs with the data being pulled from reduced_protest_dataV2.csv. The folder Previous Versions includes past versions of code and data files that are currently not in use while the Code Sample folder holds short files that included snippets of code that were used to incorporate various features piecemeal over time.

You're encouraged to submit many ideas-- staff will help you identify the most promising ones and possible roadblocks.

Please stick to 1-4 folks per team.

Final Project Materials
Design Achievements
---
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:

- 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?

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.

Tip: Start your process book on Day 1. Make entries after each meeting, and trim / edit as needed towards the end of the project. Many folks use either slides software (like PowerPoint) or Google Docs to make this book, as both allow for flexible layouts and export to PDF.


### Project Website

Create a public website for your project using GitHub pages or another 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 if possible, unless you're running an experiment, etc.) 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 or Loom (new and recommended).
Please make sure that the sound quality of your video is good -- it may be worthwhile to invest in an external USB microphone-- campus IT should have some you can borrow.
Upload the video to an online video-platform such as YouTube or Vimeo and embed it into your project web page.
For our final project presentation day, we will show as many videos in class as possible, and ask teams to field questions.
- Utilized Figma to create a mockup/prototype of visualization
- Utilized guidelines from IBM's Carbon Design System for data visualization color palletes to ensure that the visualization is accessible

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
---

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 Material UI, React, Svelte, etcetera.

Please *do not* use libraries on top of d3 without consulting staff, however.
Libraries like nvd3.js look tempting, but such libraries often have poor defaults and result in poor visualizations.
There may be exceptions.
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.

Resources
Technical Achievements
---
The "[Data is Plural](https://tinyletter.com/data-is-plural/archive)" weekly letter often contains interesting datasets.
- Utilized Observable to expedite the process of creating visualization code

KAGGLE IS BANNED! You may propose to use a dataset from there if you really have a deep/cool idea, but please run it by me first.

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

Requirements
Website
---

Store the following in your GitHub repository:
https://shivalimani.github.io/Final-Project-CS4804/index.html

- 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
Screencast
---

- 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 "main" 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.
https://www.loom.com/share/b8fed780439b40e29c6893788d7b25d7

References
---

- This final project is adapted from https://www.dataviscourse.net/2020/project/
- Data for this project was sourced from https://dataverse.harvard.edu/dataverse/MMdata
- [Observable](https://observablehq.com/) was used to code much of the visualization
- The code used was based on the mirrored beeswarm graph example on Observable at https://observablehq.com/@d3/beeswarm-mirrored/2
- The code for the tooltip was sourced from an Observable notebook by Mike Freeman at https://observablehq.com/@mkfreeman/plot-tooltip
Binary file added Streamlined Process Book.pdf
Binary file not shown.
Loading