Skip to main content
100%

Making a bar chart!

✓ Published0🌍 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
MIT Licensed

Similar vizzes