Pie Chart with Zoomable sectors and tooltips
forked from arpitnarechania's block: Pie Chart
xxxxxxxxxx
<html lang="en">
<head>
<meta charset="utf-8">
<title>Pie Chart</title>
<!-- JavaScript Libraries //-->
<script src="https://d3js.org/d3.v3.min.js"></script>
<!-- CSS Style //-->
<link href="style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="main.js"></script>
</head>
<body>
<div><span style="text-align:center;margin-top:20px"><h4>Rise of Emporer</h4><span></div>
<div style="margin:50px;text-align:center" id="chart"></div>
</body>
<script>
d3.csv("roman.csv", function(data) {
var dataByRise = d3.nest()
.key(function(d) { return d.rise; })
.rollup(function(v) {
return v.length; })
.entries(data);
json = JSON.parse(JSON.stringify(dataByRise).split('"key":').join('"label":'));
json = JSON.parse(JSON.stringify(json).split('"values":').join('"value":'));
console.log(json);
var inputData = json;
var colorScheme = ["#E57373","#BA68C8","#7986CB","#A1887F","#90A4AE","#AED581","#9575CD","#FF8A65","#4DB6AC","#FFF176","#64B5F6","#00E676"];
renderPieChart(inputData,"#chart",colorScheme);
});
</script>
</html>
Modified http://d3js.org/d3.v3.min.js to a secure url
https://d3js.org/d3.v3.min.js