Skip to content

Instantly share code, notes, and snippets.

@gujc71
Last active March 20, 2017 13:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gujc71/974b377daf42d0165f863f5e05bf919d to your computer and use it in GitHub Desktop.
Save gujc71/974b377daf42d0165f863f5e05bf919d to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.bar {
fill: skyblue;
fill-opacity: 0.3;
stroke: skyblue;
}
.bar:hover {
fill-opacity: 1;
}
</style>
<svg width="500" height="300"></svg>
<script src="https://d3js.org/d3.v4.min.js"></script>
<script>
// CSS 이용: 외곽석 등
var dataset = [9, 19, 29, 39, 29, 19, 9];
var svg = d3.select("svg");
svg.selectAll("rect")
.data(dataset)
.enter().append("rect")
.attr("class", "bar")
.attr("height", function(d, i) {return (d*5)})
.attr("width", 40)
.attr("x", function(d, i) {return (50 * i)})
.attr("y", function(d, i) {return (250-d*5)});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment