HAW: Bday Data viz
✓ Published1🌍 Public
This visualization compares annual birth statistics across four years by rendering each year as a hospital building, with the number of birth dots inside representing relative crowdedness. React manages the component state and container sizing via a custom `useContainerDimensions` hook, while D3 v7 handles SVG rendering and data joins through `d3.select` and `d3.csv`. The chart pulses with an interactive hover effect on hospital bodies, and the code explicitly generates synthetic multi-year data by applying variations to the loaded CSV totals from `data.csv`.
AI-generated descriptionBirth Data Visualization - Radial Chart
An interactive radial chart showing monthly birth statistics from multiple years using React and D3.js.
Features
- Radial layout: Months arranged around a circle starting with January at the top
- Multi-year comparison: All available years displayed together for easy comparison
- Monthly aggregation: Daily birth data aggregated by month (showing average births per day)
- Interactive data points: Hover over points to see exact values and year information
- Responsive design: Chart automatically resizes to fit the window
- Grid lines: Both circular and angular guides for easier data reading
- Color-coded years: Each year has a distinct color for easy identification
- Legend: Year labels with corresponding colors
- Smooth rendering: Optimized for performance
Data Format
The chart displays data from data.csv with the following
columns:
Datum: Date in DD-MM-YYYY formatLebendgeborene: Number of live births
File Structure
index.html- Main HTML entry pointindex.jsx- React app initializationApp.jsx- Main React componentviz.js- D3 visualization orchestratorrenderRadialChart.js- Radial chart rendering logicuseContainerDimensions.js- Custom hook for responsive sizingstyles.css- Global stylesdata.csv- Birth statistics data
How It Works
- Data Loading: CSV data is loaded and parsed on component mount
- Grouping by Year: Daily data is organized by year
- Monthly Aggregation: Each year's data is aggregated by month, calculating average births per day
- Responsive Sizing: Container dimensions are tracked using ResizeObserver
- D3 Rendering: Chart is rendered using D3.js radial scales, with months as angles and birth data as radii
- Multi-Year Display: All years are displayed simultaneously with different colors
- Interactivity: Tooltips appear on hover to show detailed information including year
Chart Layout
- January starts at the top (12 o'clock position)
- Months progress clockwise around the circle
- Radius represents average daily births for that month
- Circular grid lines show magnitude
- Angular grid lines separate months
- Each year is represented by a different color
- Legend in the top-right shows which color corresponds to which year
MIT Licensed