Trajectory of Harry Potter series
MAT 259, 2022
Yifei Liu

Concept
I am interested in visualizing the trajectory of moving agents, however, the tiger GPS data that I used in my research is confidential, so I decide to continue using the Harry Potter data. I would like to show how every book moves from check-out date to check-in date and then jump to the next check-out date. The trajectory each agent is creating will show in bright color, while the past trajectory will be in gray. Each agent will look like a swimming tadpole. The moving speed and size of the point will depend on how long the borrowed book is being kept.

Query
SELECT itemNumber, bibNumber, cout, cin, title, DATEDIFF(cin, cout) AS diff, (CASE WHEN (title LIKE '%Harry Potter%' AND title LIKE '%Sorcerer%') THEN 'HP1' WHEN (title LIKE '%Harry Potter%' AND title LIKE '%Chamber%') THEN 'HP2' WHEN (title LIKE '%Harry Potter%' AND title LIKE '%Azkaban%') THEN 'HP3' WHEN (title LIKE '%Harry Potter%' AND title LIKE '%Goblet%') THEN 'HP4' WHEN (title LIKE '%Harry Potter%' AND title LIKE '%Phoenix%') THEN 'HP5' WHEN (title LIKE '%Harry Potter%' AND title LIKE '%Half Blood Prince%') THEN 'HP6' WHEN (title LIKE '%Harry Potter%' AND title LIKE '%Deathly%') THEN 'HP7' WHEN (title LIKE '%Harry Potter%' AND title LIKE '%cursed%') THEN 'Cchild' WHEN (title LIKE '%Fantastic Beasts%' AND title LIKE '%Where to find%') THEN 'FBWTF' WHEN (title LIKE '%Fantastic Beasts%' AND title LIKE '%Grindelwald%') THEN 'FBCG' WHEN title LIKE '%Quidditch%' THEN 'Quid' WHEN title LIKE '%Beedle the Bard%' THEN 'TBB' END) AS Series, (CASE WHEN itemType = 'jcbk' THEN 'juvbook' WHEN itemType = 'acbk' THEN 'adultbook' WHEN itemType = 'jccas' OR itemType = 'jccd' OR itemType = 'jccdrom' OR itemType = 'jcvhs' THEN 'juvmedia' WHEN itemType = 'accd' OR itemType = 'acdvd' OR itemType = 'acvhs' THEN 'adultmedia' WHEN (itemType = 'accd' OR itemType = 'acdvd' OR itemType = 'acvhs') AND title LIKE '%Part 1%' THEN 'adultmediaP1' WHEN (itemType = 'accd' OR itemType = 'acdvd' OR itemType = 'acvhs') AND title LIKE '%Part 2%' THEN 'adultmediaP2' END) AS Type FROM spl_2016.inraw WHERE (((title LIKE '%Sorcerer%' OR title LIKE '%Chamber%' OR title LIKE '%Azkaban%' OR title LIKE '%Goblet%' OR title LIKE '%Phoenix%' OR title LIKE '%Half Blood Prince%' OR title LIKE '%Deathly%' OR title LIKE '%cursed%') AND title LIKE '%Harry Potter%') OR ((title LIKE '%Where to find%' OR title LIKE '%Grindelwald%') AND title LIKE '%Fantastic Beasts%') OR title LIKE '%Quidditch%' OR title LIKE '%Beedle the Bard%') AND YEAR(cout) > 2000 AND YEAR(cin) > 2000

Preliminary sketches
I'm inspired by trajectory visualization of DynamoVis, which use colors, size of points, and widths of lines to show different parameters.
Website link: https://github.com/move-ucsb/DynamoVis


Process
In Project 2 I summarized the total number of Harry Potter series in each category that were borrowed each day. In this project I will trace the check-in and check-out date of each book according to the itemNumber (unique id for every book). Organized Harry Potter data is attached.

I first created a box with x, y, and z axis are year (2005-2022), day (Jan 1 to Dec 31), and time (00:00-23:59), and plot all the book record into the box as points with 12 colors for each category. The color is the same as the one used in Project 2. The points look like cloud in the box. Then I use PVector function to make the point and its trajectory move with time. The current trajectory is shown with bright color and no transparency, while the past trajectory is grey and partly transparent according to the time the book has been kept.








Final result
Finally, I added interaction part to this project. I add a slider to control the process of moving (time), and another slider to control speed (how fast the points move). The number of books that is borrowed (Active Books Numbers) and total checkout numbers of current time is shown at the bottom left corner grouped by 12 categories.

The point size is modified according to the time the book is kept. Thus, the large points move slowly, and small points move faster and vanish faster.






Code
All work is developed within Processing
YifeiLiu_Project3_HarryPotterV4.zip