Fatal Police Shootings Pie Chart Working Copy
This interactive visualization explores fatal police shootings in the U.S. using a dynamic bar chart that groups and counts incidents by selected attributes like race, gender, or flee status. Users select a variable from a dropdown menu, and the chart updates to show the distribution of events across categories. The application loads CSV data from the Washington Post database and uses React with D3 v5 APIs including d3.nest, d3.scaleOrdinal, d3.scaleLinear, and d3.pie to aggregate and prepare the data. The included Pie Chart working copy renders SVG elements but does not yet display the pie chart visualization.
AI-generated descriptionA program that loads and parses some CSV data from the Fatal Police Shootings Database compiled by the Washington Post
The intent is to map each event to it's location within the U.S. with a semitransparent circle to show darker regions as the areas with higher event density. This helps to answer the question "are there more fatal police shootings in certain parts of the country?" There are clearly areas with more events, though at a glance they appear to be in population centers.
I realized that my project timeline for this week involves cleaning up the charts, but next week I have adding additional menu functionality to the charts. That seemed backwards, so I focused on building a menu to select a variable and the functionality to dynamically regroup and count the data based on the selected value. For now the data is in a bar chart, but I'd like to try to put it into a pie chart.
I borrowed heavily from the Polished Scatter Plot with Menus posted by the professor.
To do:
- Build a menu based on interesting data fields
- write the code to group and aggregate the data based on the dynamic selection
- reintroduce aggregation of data per state in addition to the new functionality
- adjust to build a pie chart with this data
- develop a module to plot pie charts in the center of each state
- use the path.centroid() function to plot aggregated data