Skip to main content
100%

Activity6_Task2 Question 2

✓ Published0🌍 Public
Vvemulasai306@gmail.com
Last edited Oct 22, 2024
Created on Oct 22, 2024
Forked from Activity6_Task2

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 description

An example showing the capabilities of VizHub:

  • Loads D3 via UNPKG.
  • Demonstrates use of import from "d3".
  • Demonstrates use of import from local ES6 modules.
MIT Licensed

Similar vizzes