A new directory has been created on the git repository, which you should complete this assignment in. To merge this into your repository, navigate to your workbook directory using a command line and run the following commands:
The goal of this assignment is to complete the key steps in creating a visualization. At the end of this assignment, you will have created a visualization similar to the following:
This assignment is broken up into two parts:
In compute.py, add a new dictionary entry to each row called Streak
.
This value should be the Illini win streak against the team from the preceding years.
For example, consider the 1953 Illinois vs. Michigan game, which is found in line 690 of illiniFootballScores_1892_2015.csv:
To find the Illini win streak coming into this game, you must find the game from the previous years and find the results of the games until the Illini lost or didn't play that team:
Coming into the 1953 Illinois vs. Michigan game, the Illini were on a 3 game winning streak since the Illini won the game in 1952, 1951, and 1950 and lost the game in 1949.
The output for the 1953 Illinois vs. Michigan game should be the following in the JSON:
This can be completed by simply adding the code below once you have the streak calculated in a variable streak:
Before starting with the visual encoding, ensure your JSON is correct. Open your JSON and verify that the 1953 Michigan game matches the data above. (The order of the entries in the dictionary will be different, but all the entries should be there.)
Only once you are certain your data is correct, continue to the visual encoding.
Open vis.js (inside of your web directory) and jump down to Line 132, which starts the visual encodings:
To complete the visual encoding, you must define the cx
,
cy
, r
, and fill
attributes for
each circle. We have already defined two scales to help you with the
cx
and cy
. You can use the following code
(in bold) to correctly position the circles:
Continue with the code to define a r
and fill
attribute. You can use the HSL Color Picker by Brandon Mathis
as a good way to find a good color for wins and losses.
Use your workbook to view your visualization. If you do not see any visualization, you can use the console in your web browser (Right Click, Inspect, and choose the Console tab).
This activity is submitted digitally via git. View detailed submission instructions here.