D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
gokatz
Full window
Github gist
d3 lesson - sherley wu - fem
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; } </style> </head> <body> <svg id="root" height="150"></svg> <script> let graphData = [20, 5,100, 49, 22, 67, 8, 56,19]; let graph = d3.select('#root') .selectAll('rect') .data(graphData).enter().append('rect') .attr("height", (d) => { return d }) .attr("width", "20") .attr('x', (d, i) => { return (i*25) }) .attr('y', (d, i) => { return (150-d) }) .attr("fill", "red") </script> </body>
https://d3js.org/d3.v4.min.js