Inspiration:
In this project, I aimed to create a dynamic visualization of baby names by ethnicity, year, and gender using data from a CSV file. The inspiration for this project came from the realization that names are not just identifiers; they often carry cultural significance and reflect societal trends. By exploring how different ethnicities and genders influence naming patterns over time, I wanted to highlight the diversity and richness of society. This interactive visualization allows users to engage with the data, making it easier to understand how names evolve and resonate within various communities within the US. The data for the USA was readily available and organized, and thus I decided to pick that as my dataset.
Code that I am particularly proud of:
One of the sections of my code that I am particularly proud of is the get_top_names function. This function processes the CSV data to extract the top ten baby names based on user selected criteria including ethnicity, year, and gender. This code tallies the occurrences of each name and sorts them to ensure that the most popular names are displayed in the visualization.
// This function processes the provided data to get the top 10 names function get_top_names(ethnicity, year, gender) { let names = {}; for (let row of table.rows) { // filters the data based on our current selection if (row.get('Year of Birth') === year && row.get('Ethnicity') === ethnicity && row.get('Gender') === gender) { let name = row.get("Child's First Name"); let count = parseInt(row.get('Count')); // sums up counts for each name to account for duplicates if (name in names) { names[name] += count; } else { names[name] = count; } } }
Final Product:
Conclusions and Reflections:
Reflecting on this project, I recognize the power data visualization holds in uncovering trends and fostering human understanding and comprehension. I learned how to manipulate data and create interactive elements that allow users to explore and compare information. However, there are several areas for improvement. For instance I hope to incorporate additional features such as user-input filters or a broader range of years. I hope to also include an overlay feature where two separate bar charts can be compared on the same canvas, this could be useful for example if someone wants to more clearly see the trend of a certain name through time. Additionally, I plan to improve the aesthetics of the visualization by experimenting with different color palettes and designs to make it more appealing. Overall, this project has been a valuable learning experience, and I look forward to applying these insights in later projects.