Activity6_Task2 Question 2
✓ Published0🌍 Public
This stacked bar chart visualizes the macronutrient breakdown—carbohydrates, fats, and proteins—across six food categories using data from a local CSV file. The chart uses `d3.stack()` to generate stacked series and `d3.scaleOrdinal` for color mapping, with bars rendered as SVG rectangles. Axes are built with `d3.axisBottom` and `d3.axisLeft`, while a legend is manually appended as colored rectangles and text labels. The visualization highlights proportional differences in nutrient composition, such as fruits being nearly all carbohydrates.
AI-generated descriptionAn example showing the capabilities of VizHub:
- Loads D3 via UNPKG.
- Demonstrates use of
importfrom"d3". - Demonstrates use of
importfrom local ES6 modules.
MIT Licensed