🌍 Public
Viewing a saved revision (read-only)
579ea432c6d64068b28a5cad347d2f10
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