Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

A4 Barchart D3

Public visualization

A4 Barchart D3

0 stars5🌍 Public
EEric Yao
Last edited Mar 4, 2024
Created on Feb 18, 2024
Forked from HTML Starter

This bar chart tracks the percentage of total smokers in the United States from 1980 to 2012, revealing a steady decline over three decades. The visualization uses an SVG canvas rendered with D3.js v7, where bars are drawn using SVG `rect` elements scaled by a band scale on the x-axis and a linear scale on the y-axis. Data is loaded from a CSV file via `d3.csv` and axes are generated with `d3.axisBottom` and `d3.axisLeft`. Hovering changes bar color to orange, and tooltips show the exact percentage per year.

AI-generated description

Reference: https://d3-graph-gallery.com/graph/barplot_basic.html

Also used chatgpt to implement certain features

Comments

Sign in to join the discussion.

MIT Licensed