d3을 사용하여 이와 같은 작업을 수행 할 수 있습니까?D3.js 원형 차트 .. 선택할 때 원형 조각 이동이 가능합니까?
어디 특정 파이를 클릭하면 클릭에 슬라이스 이동 슬라이스?
내가<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font: 10px sans-serif;
}
.arc path {
stroke: #fff;
}
</style>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
var width = 960,
height = 500,
radius = Math.min(width, height)/2;
var color = d3.scale.ordinal()
.range(["#98abc5", "#8a89a6", "#7b6888", "#6b486b", "#a05d56", "#d0743c", "#ff8c00"]);
var arc = d3.svg.arc()
.outerRadius(radius - 10)
.innerRadius(0);
var pie = d3.layout.pie()
.sort(null)
.value(function(d) { return d.population; });
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height)
.append("g")
.attr("transform", "translate(" + width/2 + "," + height/2 + ")");
d3.csv("data.csv", function(error, data) {
data.forEach(function(d) {
d.population = +d.population;
});
var g = svg.selectAll(".arc")
.data(pie(data))
.enter().append("g")
.attr("class", "arc");
g.append("path")
.attr("d", arc)
.style("fill", function(d) { return color(d.data.age); });
g.append("text")
.attr("transform", function(d) { return "translate(" + arc.centroid(d) + ")"; })
.attr("dy", ".35em")
.style("text-anchor", "middle")
.text(function(d) { return d.data.age; });
});
</script>
데이터는 CSV 파일에서 오는이 기능을 추가 할 경우이 시점까지 만든 파이 그냥 궁금하게한다.
감사합니다.
감사합니다, 내가 원하는 정확히 – jayfah
당신은 매우 비슷한 질문 좀 도와 수있을 @Gilsha http://stackoverflow.com/questions/37031238/using-d3-js-to-modify-c3 -js-chart – user1010101