D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
GeneExplorer
Full window
Github gist
BioinformaticsQuestion13
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 svg = d3.select("body").append("svg") .attr("width", 960) .attr("height", 500) // Flag Dimensions var flagOffsetX = 180 var flagOffsetY = 50 var flagHeight = 400 var flagWidth = 1.5 * flagHeight var stripeWidth = flagWidth / 3 // Make a border around the entire flag. svg.append("rect") .attr("y", flagOffsetY) .attr("x", flagOffsetX) .attr("width", flagWidth) .attr("height", flagHeight) .attr("stroke", "#000000") // Blue Stripe svg.append("rect") .attr("y", flagOffsetY) .attr("x", flagOffsetX) .attr("width", stripeWidth) .attr("height", flagHeight) .attr("fill", "#0055A4") // White Stripe svg.append("rect") .attr("y", flagOffsetY) .attr("x", flagOffsetX + stripeWidth) .attr("width", stripeWidth) .attr("height", flagHeight) .attr("fill", "#FFFFFF") // Red Stripe svg.append("rect") .attr("y", flagOffsetY) .attr("x", flagOffsetX + (2 * stripeWidth)) .attr("width", stripeWidth) .attr("height", flagHeight) .attr("fill", "#EF4135") </script> </body>
https://d3js.org/d3.v4.min.js