Fatal Police Shootings Chart Working Copy
This interactive bar chart visualizes fatal police shootings in the United States, allowing users to explore how incidents distribute across categories such as race, gender, and armed status. The chart dynamically aggregates counts from the Washington Post dataset using d3.nest() and presents results through React components with SVG rendering. Users select a variable from a dropdown menu, triggering the x-axis to update via React's state management. The implementation uses d3.scaleBand and d3.scaleLinear for axes, with native SVG `<title>` tooltips embedded in each bar.
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