Tutorial D3 2
✓ Published0🌍 Public
JJuanSMartinez
Last edited Sep 7, 2016
Created on Sep 7, 2016
This example demonstrates a horizontal bar chart that updates its bar widths based on a data array, using D3 v4 with SVG and animated transitions. It shows how to bind data to rectangles, handle enter/exit/update selections, and smoothly resize bars over one second. The code uses `d3.scaleLinear` for the width scale, `d3.scaleOrdinal` with `d3.schemeCategory20` for bar colors, and `transition().duration(1000)` to animate both entering and exiting bars. The visualization initially renders six bars with values from a hardcoded array, highlighting basic D3 data-join patterns.
AI-generated descriptionBuilt with blockbuilder.org
mit Licensed