D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
Igathi
Full window
Github gist
block with text
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 wide = 150; var high = 150 var texX = wide/4 - 20; var texY = high/2 + 10 var svg = d3.select("body") .append("svg") .attr("width", 1500) .attr("height", 500) svg.append('rect') .attr('width', wide) .attr('height', high) .attr('x', 10) .attr('y', 10) .style('fill', 'red') svg.append('rect') .attr('width', wide) .attr('height', high) .attr('x', wide+30) .attr('y', 10) .style('fill', 'blue') svg.append("text") .text("Red box!") .attr("x", texX) .attr("y", texY) .attr("font-size", 25) .attr("font-family", "monospace") texX = texX+wide+20 svg.append("text") .text("Blue box!") .attr("x", texX) .attr("y", texY) .attr("font-size", 25) .attr("font-family", "monospace") </script> </body>
https://d3js.org/d3.v4.min.js