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; }
#chart {
position: fixed;
left: 0px;
right: 0px;
top: 0px;
bottom: 0px;
}
</style>
</head>
<body>
<div id= 'chart'></div>
<script>
// Feel free to change or delete any of the code you see in this editor!
var chartDiv = document.getElementById("chart");
//This must remain outside of render function
var svg = d3.select(chartDiv).selectAll('svg').data([null]);
svg = svg.enter().append('svg');
////////////////////////////////////////////
var redraw = function(){
var height = chartDiv.clientHeight;
var width = chartDiv.clientWidth;
svg = svg.merge(svg)
.attr('height', height)
.attr('width', width)
;
svg.exit().remove();
var text = svg.selectAll('text').data([null]);
text = text.enter().append('text')
.merge(text)
.text("Edit the code below to change me!")
.attr("y", height/2)
.attr("x", width/5)
.attr("font-size", height/15)
.attr("font-family", "monospace")
.attr('stroke', 'black');
text.exit().remove();
};
redraw();
window.addEventListener("resize", redraw);
</script>
</body>
https://d3js.org/d3.v4.min.js