generator-d3-plugin
Version:
Yeoman generator for D3 v4 plugins
40 lines (34 loc) • 753 B
HTML
<html>
<head>
<title>D3 plugin</title>
<style type="text/css">
svg {
margin: 50px;
background: rgba(0, 0, 0, 0.58);
}
svg text {
stroke: white;
fill: white;
}
</style>
</head>
<body>
<div id="chart"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/4.4.0/d3.min.js"></script>
<script type="text/javascript" src="./build/<%= packageName %>.js"></script>
<script type="text/javascript">
var w=960,h=500,
svg=d3.select("#chart")
.append("svg")
.attr("width",w)
.attr("height",h);
var tb = d3.textBlock().label(function(d) {return d;});
var item = svg.selectAll("rect")
.data([1])
.enter()
.append("svg:g")
.call(tb);
</script>
</body>
</html>