Skip to main content
100%

Activity6_Task2- 3

✓ Published0🌍 Public
Nnissisharon61@gmail.com
Last edited Mar 31, 2025
Created on Mar 31, 2025
Forked from HTML Starter

This horizontal stacked bar chart visualizes the proportional distribution of fruit prices across five price ranges, from "Below 1.0" to "Above 4.0", using 100% stacked bars. The d3.stack() function with stackOffsetExpand normalizes each fruit's segments to a percentage scale, while d3.scaleOrdinal assigns distinct colors. The code uses D3 v7 APIs such as d3.axisBottom, d3.axisLeft, and the join operation for efficient element creation. Labels appear only where segments exceed 40 pixels in width, and a legend in the top-right corner maps colors to price ranges.

AI-generated description

Activity6 - 3

MIT Licensed

Similar vizzes