Built with blockbuilder.org
xxxxxxxxxx
<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>
// Feel free to change or delete any of the code you see in this editor!
var svg = d3.select("body").append("svg")
.attr("width", 2000)
.attr("height", 1000)
/* svg.append("text")
.text("Edit the code below to change me!")
.attr("y", 200)
.attr("x", 120)
.attr("font-size", 36)
.attr("font-family", "monospace")
*/
var genes=[{"name": "1", "start": 50, "end":100, "direction": "F", "function": "function1", "fill": "turquoise"},
{"name": "2", "start": 120, "end":200, "direction": "F", "function": "Function 2", "fill": "lavendar"},
{"name": "3", "start": 300, "end":350, "direction": "R", "function": "Function 3", "fill": "red"},
{"name": "4", "start": 400, "end":480, "direction": "F", "function": "Function 4"}
];
console.log(genes);
svg.selectAll("rect")
.data(genes)
.enter()
.append("rect")
.attr("y",200)
.attr("start", function(d) {return d.start})
.attr("height", 50)
.attr("fill", function(d) {return d.fill})
.attr("stroke", "black");
</script>
</body>
https://d3js.org/d3.v4.min.js