History in Holograms: USA Voter Turnout, 1980 – 2012

Augmented Reality ,Blog Posts ,HoloLens ,Programming ,Unity ,Universal Windows
November 7, 2016

This election cycle has been exhausting – it feels like today, more than ever, every political party, media outlet, social media site, and advertisement is screaming the message loud and clear: Go Vote. With elections just one day away, the end of this plea comes quickly and, for many folks, not a moment too soon.

A few months ago, I started tracking the updates on FiveThirtyEight – and I really appreciated the visualization of different states as Nate Silver and his team ran through thousands of simulations to track odds of different outcomes of the 2016 elections. This was right around the time I got my HoloLens, so naturally, I was drawn to a single, obvious conclusion: I had to make some type of an election app for Windows Holographic.

The Idea

I originally thought that I’d track this year’s election, doing a pretty simple variation of the map that is featured on FiveThirtyEight – but as I did some research into the data sets that they have available, I realized that unless I was also running thousands of simulations from polling sources, I was going to end up with some significantly skewed data. The more I thought about it, the more my curiosity shifted to a different area of consideration: voter turnout in general.

A graph from ElectProject.org displaying voter turnout percentages in national general elections

A graph from ElectProject.org displaying voter turnout percentages in national general elections

I decided to take this idea and go further with it after finding a data set on ElectProject.org that listed voter turnout by state since 1980. After browsing through the data to get a sense of what I was looking at, I was ready to tackle the next step of the project.

The Data

When I first started this project, the data set that I got from the Elect Project felt like it was a lot for a small demo application, so I started by paring down the information into a few key components that I thought would be the most interesting to research. From the entire list of data points, I chose to look at the following for each state:

  • Voter Eligible Population (VEP) turnout for the highest electible office
  • Total Ballots Counted
  • Total VEP in the state

I also included the Geography (state name) and alphanumeric code for each state.

To get the data into a format that I could use easily with Unity, I downloaded the spreadsheet from the Elect Project website and took out the extraneous data points that I wouldn’t be using in my visualization. I then saved it as a .CSV file, and converted it to JSON to read into a custom object class that I wrote using C#. I quickly realized that the JSON file as it stood was too large to work with cleanly, so I made a huge mess of it and chopped it up, giving each year its own file.

Each JSON file was placed into a streaming assets folder to access with the Windows 10 Universal file system APIs

Each JSON file was placed into a streaming assets folder for access with the Windows 10 Universal file system APIs

To manage the data from each file, I created a class to hold references to each data entry. A JSON Data Manager class parsed the files and stored the information as State Vote Objects. These objects were then contained in a List<StateVoteObjects>,with one List per year.

The State Vote Object class

The State Vote Object class

The Visualization

Once I had access to all of my data from inside Unity, it was time to visualize the information. I decided that what I wanted was the ability to use a slider control to go through the different years, and I decided on a simple red/green color scheme to represent VEP highest office. To really showcase how each of the different states voted, naturally, a 3D map of the United States was needed. I used this model from TurboSquid, which imported into Unity wonderfully and was incredibly well-made: a steal at $6.

hl5

3D Map of the USA in the Unity Editor

To represent the information from each state’s voter turnout class, I was able to map each of the StateVoterObjects in my lists to their corresponding game object within the scene. Since I already had the name string saved in the object, and the map had each state named individually, mapping the two together was a breeze. There were a few things that I changed visually about the states as the application processed the data from the different years:

  • If a state had more than 50% of their VEP show up and vote in a given year, the state was displayed in green. The darker green a state, the closer it was to 100%
  • If a state had fewer than 50% VEP voting, the state was displayed in red. The brighter red a state was, the closer to 0% the turnout was
  • The y-value of each state was the VEP relative to the scale of the rest of of the states. In the hologram, you can see a variation in the heights of each state relative to the VEP turnout.

To change between the different years, I created a slider component that would let you go back in time through 1980 to see each election. Each tick on the slider represented a different election year, including midterm elections.

The slider with display text in all its patriotic glory

The slider with display text in all its patriotic glory

Changing the slider value was handled by a slider manager, which would swap out the active state information list to the one indicated, and send messages to the states to update their own values accordingly. I also decided to add in an additional information panel that would display information about a specific state when one was selected by the map, so the slider manager also handled refreshing that to indicate a new year had been chosen.

The SliderManager.cs class

The SliderManager.cs class

With the basic visualization components in place, it was time to start adding in the fun part: the holograms!

Using the Holographic Toolkit

I’ve written about the HoloToolkit on my blog before, so I won’t go into too much detail that has already been covered there, but basically, the HoloToolkit-Unity repository contains a lot of really helpful components to enabling Windows Holographic for your Unity applications. Since I had the underlying components of my visualization app working, I went ahead and started modifying some of the input to work with gesture and gaze commands.

The first things that I added from the HoloToolkit were the camera, GazeManager, GestureManager, and GazeStabilizer classes onto a central ‘Managers’ game object. The camera setup was a drag and drop to replace the default, and the majority of the functionality for handing the device detection of gaze and gestures are contained in Gaze/Gesture manager classes, so all that was needed on my end was to write handlers for the detection and interactions on the game objects in my scene. I broke it down into two categories of interactions.

The slider needed to know when I was selecting it via a combination of a gaze + air tap, then detect when I dragged my air tap to slide the handle on the bar to change the year. To do this, I added a box collider to the star (handle) on the slider, and added a new ‘HandleManager.cs’ class:

using UnityEngine;
using HoloToolkit.Unity;
using UnityEngine.UI;
using System.Collections;

public class HandleManager : MonoBehaviour {
    bool isPressed = false;
    public Slider _slider;
    private Vector3 previousPosition;
    
	// Use this for initialization
	void Start () {
 
	}
	
	// Update is called once per frame
	void Update () {
	    if(GestureManager.Instance.ManipulationInProgress && isPressed)
        {
            Debug.Log("Moving slider");
            UpdateSliderPosition(GestureManager.Instance.ManipulationHandPosition);                        
        }
	}

    // Update Slider Position
    void UpdateSliderPosition(Vector3 _handPos)
    {
        float prevX = previousPosition.x;
        float diffX = _handPos.x - prevX;
        Debug.Log(diffX);
        if(diffX >= .03f)
        {
            _slider.value++;
            previousPosition = _handPos;
        }
        else if(diffX <= -.03f)
        {
            _slider.value--;
            previousPosition = _handPos;
        }
    }
    // OnGazeEnter
    public void OnGazeEnter()
    {
        Debug.Log("Looking at handle object");
    }
    // OnGazeLeave
    public void OnGazeLeave()
    {
        Debug.Log("No longer looking at handle object");
    }
    // OnPressed
    public void OnPressed()
    {
        Debug.Log("Pressing on the slider");
        previousPosition = GestureManager.Instance.ManipulationHandPosition;
        isPressed = true;
    }
    // OnReleased
    public void OnReleased()
    {
        Debug.Log("No longer pressing on slider");
        isPressed = false;
    }
}

This script listened for when the handle was pressed, then calculated how far the slider should move based on the total distance traveled by my air tap+drag gesture. It’s important that the names of the receiver functions match, because the Gaze and Gesture manager already contain the code to send the OnReleased, OnPressed, OnGazeLeave, and OnGazeEnter commands based on those names.

The next interaction that I wanted to add into the application was a gaze+tap command to specify that I wanted to get more information about whichever state I was looking at. To do this, each state in my USA map was given a StateVoterController script, which handled:

  • Changing the way the state was displayed on year changes
  • Updating the color of the state dependent on turnout values
  • Identifying when the state was “clicked” on with an air tap
  • Sending the state information to the UI that displayed contextual information

Again, since the gaze and gesture managers handle the bulk of this for you, I simply added in an “OnSelect” function to my StateVoterController script:

    // On Select
    public void OnSelect()
    {
        tName.text = "State: " + mStateObjectInformation.sNAME;
        tPercent.text = "Turnout: " + mStateObjectInformation.sPERCENTVOTEHIGHESTOFFICE;
        tVep.text = "VEP: " + mStateObjectInformation.ulVOTINGPOPULATION;
    }

The full map running in Unity

The full map running in Unity

After adding in the detail UI pane for the selected states, and adding a loading screen that covered the basics of how the app visualization worked, it was time to load it up on the device!

 

Takeaways

This project made a significant impact on my own personal understanding of American history and understanding our elections, as well as the problems that our election system has. I learned a lot working through this project, not just about the technological tools and Windows Holographic, but also quite a bit about our political system.

  • It’s challenging to verify voter turnout information. Many sources have different numbers for the VEP and voting age population (VAP). Even more interesting to me was that some information was off – by a lot. It’s really hard to tell what is accurate in these cases, which makes understanding the real issues underlying a lack of participation in the electoral process extraordinarily difficult to verify. Take, for example, the state of Hawaii: in the data provided by the Election Project, Hawaii was the only state that never showed 50% or more voter turnout in an election – but a government site from Hawaii had claims that voter turnout in the state was over 70% for corresponding years.
  • I knew that non-presidential election years saw less participation than years with presidential candidates, but visualizing it over time interspersed with presidential election years was sobering. There is a lot of influence that local elections can have, and to see how few people in the majority of the states participate was a bit shocking.
  • I was amazed to see how many states had less than 50% turnout in years where presidential elections were close. In 2012, my college’s county went red by 103 votes – and while overall, the entire state ended up blue, it was kind of crazy to me to see how small of a number determined that for where I lived at the time. When you consider that, and then scale it up, the fact that there have been presidential elections where voter turnout is in the 40% range has serious implications over representation.

I didn’t make this project with the intention to make a statement on voting in the US, though there is a lot to consider and a lot at stake that we aren’t always able to feel empowered to do anything about – but all of that said, working on this project has really helped me see the entire process differently, and to take action.

Why make this a mixed reality application?

There is something that really inspires me about seeing and interacting with data in a non-distracting way. When I have my HoloLens headset on, I’m looking at and engaging with information in a way that allows me to fully digest what I’m seeing. I’ve already mentioned that the accuracy of voter turnout can be hard to judge sometimes, but to me, this entire process was about taking a subject that I’ve struggled to feel empowered to act on and make it feel more real. While it’s hard to see in the video, the depth of the states makes a huge impact on how I’m able to quickly compare states and see, perhaps, where some of the real change needs to happen.

There are a number of other features that I’d like to build on with this data set. I’d like to investigate more of the trends that I see, and ideally, I’d love to be able to enable more a more granular breakdown in the states of how different cities and counties vote. I’d like to allow experts to mark up the states to showcase issues with where polling stations are, and how difficult it can be in gerrymandered districts to break free of biased voting conditions. These sorts of features will make use of the 3D graphic technology more so than the current state of the app, and I’m excited even seeing this far how much potential that Holographic applications have for data visualization and changing the way we understand the problems facing us socially today.

Related Posts

1 thought on “History in Holograms: USA Voter Turnout, 1980 – 2012”

  1. Samee Khan says:

    A really cool read. As a beginning developer, I had never been presented with this much detail on the development process. It still amazes me how making a seemingly simple app requires so much thought. Your app harnesses the power of OOP and makes it clear that good design early on makes for easy implementation later.

    Thanks for the post. I’m very intrigued to read into your other posts.

Leave a Reply