Does anyone know how to create a line/circle chart that has lines extended to different quadrants that represent different data points using JavaScript SVG?
The image below demonstrates what I'm seeking.
Started out by mapping a dougnut chart with placeholders where the line(s) could ricochet off.
//latest fiddle
http://jsfiddle.net/Qh9X5/10152/
The next step is to plot a line to bounce off the markers.
var slice = svg.select(".slices").selectAll("path.slice")
.data(pie(data));
slice.enter()
.insert("path")
.attr('fill', function(d, i) {
console.log("d", d);
return colores_google(i);
})
.attr("class", "slice");
slice
.transition().duration(1000)
.attrTween("d", function(d) {
this._current = this._current || d;
var interpolate = d3.interpolate(this._current, d);
this._current = interpolate(0);
return function(t) {
return arc(interpolate(t));
};
})
slice.exit()
.remove();
var placeholders = svg.select(".placeholders").selectAll("circle.placeholder")
.data(pie(data));
placeholders.enter()
.insert("circle")
.style("fill", function(d) {
return "white";
})
.attr("transform", function(d) {
return "translate(" + arc.centroid(d) + ")";
})
.attr("r", "3")
.attr("class", function(d) {
return "placeholder " + d.data.group;
});
placeholders
.transition().duration(1000)
placeholders.exit()
.remove();
var gapplaceholders = svg.select(".placeholders").selectAll("circle.placeholder.gap");
gapplaceholders.remove();
See Question&Answers more detail:os