D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
JoelGallagher
Full window
Github gist
Entererer
Built with
blockbuilder.org
<!DOCTYPE html> <head> <meta charset="utf-8"> <script src="https://d3js.org/d3.v4.min.js"></script> <style> body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; } .bar { background-color: teal; height: 80px; margin-top: 2px; } </style> </head> <body> <div id="chart"/> <script> const data = [ 90, 70, 50, 30, 10 ] d3.select('#chart') .selectAll('div') .data(data) .enter() // gimme the enter selection and those poor orphaned data items .append('div') // create and append a new div for each data item .attr('class', 'bar') .style('width', function(d) { return (d*3) + 'px' }) </script> </body>
https://d3js.org/d3.v4.min.js