Skip to main content
100%

d3js Exercice 4 - selection, data

✓ Published0🌍 Public
YYannLive
Last edited Oct 10, 2017
Created on Oct 10, 2017

This example demonstrates a simple bar chart built with D3.js v4, where each bar’s width corresponds to a value in a static array. It shows how data can be bound to HTML elements and used to drive visual properties. The code uses `d3.select` to target the chart container, then chains `.selectAll('div')`, `.data()`, `.enter()`, and `.append('div')` to create one bar per data point. Each bar is styled via a CSS class, and its width is set directly from the data value using `.style('width', function(d) { return d + 'px'; })`. The data source is an inline array of five numbers.

AI-generated description

d3js Exercice 4 - selection, data

forked from <a href='http://bl.ocks.org/AlainRo/'>AlainRo</a>'s block: <a href='http://bl.ocks.org/AlainRo/3caa13d664a575fefa463702be9055b5'>d3js Exercice 4 - selection, data</a>

mit Licensed

Similar vizzes