Stacked Bar Chart - Attrition Level per Categories
A stacked bar chart displays customer attrition percentages across five categorical variables—income level, education level, marital status, card category, and gender—from the Bank Customers Dataset. A dropdown menu lets users switch between these categories, while bar segments encode existing versus attrited customers. Hovering over legend items highlights corresponding segments, and hovering over individual rectangles reveals exact percentage values via tooltips. The visualization is built with D3 v7, using `d3.stack` with `stackOffsetExpand`, `d3.scaleBand`, `d3.rollups` for data aggregation, and SVG rendering with animated transitions.
AI-generated descriptionStacked bar chart using D3 displaying data of attrition level by different categorical variables from the Bank Customers Dataset.
The menu at the top enable the users to choose which categorical columns to use. The options are:
- Income Level
- Education Level
- Marital Status
- Card Category
- Gender
Finally, the attrition status of the customers is encoded on the color of the bars, the users can highlight the bars by hovering over the legend values and see the exact percentage value by hovering over each individual rectangle.