Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Making a bar chart!

Public visualization

Viewing a saved revision (read-only)

2f4c9128acfb4fb89aa3cbc41f22045f

Making a bar chart!

0 stars0🌍 Public
RRoger Yu-Hsiang Lo
Last edited Jan 31, 2020
Created on Jan 16, 2020

This example shows a minimal interactive bar chart where three numeric values are displayed as SVG text elements, doubling each time the user clicks the chart. The visualization uses D3 v5’s data join pattern with `selectAll`, `data`, `enter`, and `merge` to update labels incrementally. It reads the SVG’s width and height attributes via `+svg.attr()`, while the underlying data originates from a CSV file listing country populations, though the chart initially renders hardcoded values `[1,2,3]` instead. Clicking the SVG triggers a map over the data array, demonstrating dynamic updates without axes or scales.

AI-generated description