D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
cunnellp5
Full window
Github gist
Phil Learning blocks
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> <script> var dataArray = [23, 13, 21, 14, 37, 15, 18, 34, 30, 3, 33]; var rainbow = d3.scaleSequential(d3.interpolateRainbow); var width = 960; var height = 500; var svg = d3.select("body").append("svg") .attr("width", width) .attr("height", height) .attr("class", "chart") svg.selectAll("rect") .data(dataArray) .enter().append("rect") .attr("fill", rainbow) .attr("height", (d, i) => d * 10) .attr("width", 40) .attr("x", (d, i) => i * 47 + 25) .attr("y", (d, i) => 500 -(d * 10)); </script> </body>
https://d3js.org/d3.v4.min.js