Viewing a saved revision (read-only)
f01dd4fcbacd4d728f521f5776a94a71
HAW: Bday Data viz
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
An interactive line chart showing daily birth statistics using React and D3.js.
Features
- Interactive data points: Hover over points to see exact values
- Responsive design: Chart automatically resizes to fit the window
- Grid lines: Visual guides for easier data reading
- 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 orchestratorrenderLineChart.js- Line 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
- Responsive Sizing: Container dimensions are tracked using ResizeObserver
- D3 Rendering: Chart is rendered using D3.js scales, axes, and line generators
- Interactivity: Tooltips appear on hover to show detailed information