Skip to main content
100%

fresh block

✓ Published0🌍 Public
DDanielAguirre
Last edited Oct 5, 2017
Created on Oct 4, 2017

This example shows a simple bar chart built with D3 v4, where four blue rectangles represent values from a small array. The bars scale vertically from a fixed height, with their y-positions calculated as the height minus each data value. Using `d3.select` and `d3.selectAll`, the code binds the data array to SVG `rect` elements via `data()`, then appends them with `enter()`. Each bar’s width is set to a constant 100 pixels, and positions are assigned with `attr('x')` based on index times that width. The SVG output uses `fill` for blue bars and `stroke` for white outlines.

AI-generated description

Built with blockbuilder.org

forked from <a href='http://bl.ocks.org/anonymous/'>anonymous</a>'s block: <a href='http://bl.ocks.org/anonymous/2b4cd4a90334c1714a92523212f49e95'>fresh block</a>

mit Licensed

Similar vizzes