🌍 Public
Viewing a saved revision (read-only)
6e353f123e3e4ed9810410ded8700b57
Question 2
This example presents a 100% stacked bar chart illustrating salary distribution across six departments. Each horizontal bar is segmented by five salary brackets, from “below 50k” to “above 85k,” with segment lengths proportional to the percentage of employees in that bracket. The visualization uses D3.js (v7) with an SVG rendering. It leverages the `d3.stack` API to compute stacked segments, `d3.scaleBand` for the y-axis (departments), and `d3.scaleLinear` for the x-axis (percentages). The code displays interactive tooltips on hover, showing the exact salary bracket and its percentage value, and includes a legend listing salary brackets.
AI-generated description