This project visualizes the gender pay gap across various occupations using a dumbbell chart created with D3.js. It highlights disparities in salaries between men and women for different job categories.
D3 (Data-Driven Documents) is a JavaScript library that enables dynamic, interactive data visualizations in web browsers using HTML, SVG, and CSS.
This visualization uses salary data for men and women across multiple occupations to illustrate differences in earnings. Each dumbbell represents an occupation, with endpoints showing the average salaries of men and women, and a line connecting them to depict the pay gap.
This project consists of the following key files:
index.js
: The main entry point that loads data and orchestrates rendering.data.js
: Handles loading and formatting the salary dataset.renderSVG.js
: Creates and configures the SVG container.renderDumbbellChart.js
: Contains logic for rendering the dumbbell chart.observeDimensions.js
: Enables responsiveness by tracking container size.config.js
: Stores layout and appearance settings.theme.js
: Defines color schemes and font styles.styles.css
: Contains CSS styles for the visualization.selection.data().join()
to dynamically update elements.If you're new to D3, here are some helpful resources: