forked from mbhall88's block: A static, reusable donut chart for D3.js v4.
forked from Thanaporn-sk's block: A static, reusable donut chart for D3.js v4.
xxxxxxxxxx
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Reusable Donut Chart in D3 v4</title>
<script src="https://d3js.org/d3.v4.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Roboto:400,700" rel="stylesheet">
<link rel="stylesheet" href="index.css">
<script src="index.js"></script>
</head>
<body>
<div id="chart"></div>
<script>
var donut = donutChart()
.width(960)
.height(500)
.cornerRadius(3) // sets how rounded the corners are on each slice
.padAngle(0.008) // effectively dictates the gap between slices
.variable('Number')
.category('Inspection');
d3.tsv('inspections.tsv', function(error, data) {
if (error) throw error;
d3.select('#chart')
.datum(data) // bind data to the div
.call(donut); // draw chart in div
});
</script>
</body>
</html>
https://d3js.org/d3.v4.min.js