Skip to content

Instantly share code, notes, and snippets.

@wrigh3tl
Created May 2, 2017 13:45
Show Gist options
  • Save wrigh3tl/e5b1c0b3f43f7213b7627c0976126de9 to your computer and use it in GitHub Desktop.
Save wrigh3tl/e5b1c0b3f43f7213b7627c0976126de9 to your computer and use it in GitHub Desktop.
fresh block
license: mit
var flag_data = [
{
"color": "#009246",
"width": 200,
"height": 400,
"x": 100,
"y": 50
},
{
"color": "#F1F2F1",
"width": 200,
"height": 400,
"x": 300,
"y": 50
},
{
"color": "#CE2B37",
"width": 200,
"height": 400,
"x": 500,
"y": 50
}
];
<!DOCTYPE html>
<html>
<head>
<h1>This has been an interesting nightmare</h1>
<script type="text/javascript" src="d3.v2.min.js">
var var flag_data = [
{
"color": "#009246",
"width": 200,
"height": 400,
"x": 100,
"y": 50
},
{
"color": "#F1F2F1",
"width": 200,
"height": 400,
"x": 300,
"y": 50
},
{
"color": "#CE2B37",
"width": 200,
"height": 400,
"x": 500,
"y": 50
}
];
var p = d3.select("body").selectAll("p")
.data(flag_data)
.enter()
.append("p")
.text(function (d) {return d
;});
var svgContainer = d3.select("body").append("svg")
.attr("width, 200")
.attr("height, 200");
var rectangles = svgContainer.selectAll("rectangle")
.data(flag_data)
.append(rectangle)
</script>
</head>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment