D3.js - Donut-charts mit mehreren Ringen

Das folgende Beispiel zeigt eine donut-Diagramm in D3.js ist es möglich, dass Sie mehr als einen ring um das Diagramm?

var dataset = {
  apples: [53245, 28479, 19697, 24037, 40245],
};

var width = 460,
    height = 300,
    radius = Math.min(width, height) / 2;

var color = d3.scale.category20();

var pie = d3.layout.pie()
    .sort(null);

var arc = d3.svg.arc()
    .innerRadius(radius - 100)
    .outerRadius(radius - 50);

var svg = d3.select("body").append("svg")
    .attr("width", width)
    .attr("height", height)
    .append("g")
    .attr("transform", "translate(" + width / 2 + "," + height / 2 + ")");

var path = svg.selectAll("path")
    .data(pie(dataset.apples))
  .enter().append("path")
    .attr("fill", function(d, i) { return color(i); })
    .attr("d", arc);

Beispiel: http://jsfiddle.net/gregfedorov/Qh9X5/9/

So, in meine Daten, die ich möchte etwas wie die folgenden:

var dataset = {
  apples: [53245, 28479, 19697, 24037, 40245],
  oranges: [53245, 28479, 19697, 24037, 40245],
  lemons: [53245, 28479, 19697, 24037, 40245],
  pears: [53245, 28479, 19697, 24037, 40245],
  pineapples: [53245, 28479, 19697, 24037, 40245],
};

Was ich will, ist, dass 5 Ringe insgesamt alle um die gleichen zentralen Punkt, ist das möglich und hat jemand ein Beispiel?

InformationsquelleAutor CLiown | 2013-07-06

Schreibe einen Kommentar