この種のコードの視覚化は初めてです。私はサンプルhttp://bl.ocks.org/mbostock/4062006に取り組んでいます:
それぞれの和音のラベルとして「黒」、「金髪」、「茶」、「赤」を追加したいと思います。これはどのように可能ですか。
私はこのようなことを試しましたが、うまくいきません:
var textLabel = d3.scale.ordinal().range(['Black','Blonde','Brown','Red']);
svg.append("g").selectAll("path")
.data(chord.groups)
.enter()
.append("path")
.style("fill", function(d) { return fill(d.index); })
.style("stroke", function(d) { return fill(d.index); })
.attr("d", d3.svg.arc().innerRadius(innerRadius).outerRadius(outerRadius))
svg.append("g").append("svg:text")
.attr("x", 6)
.attr("dy", 15)
.append("svg:textPath")
.text(function(d,i) { return textLabel(i+1); })
.on("mouseover", fade(.1))
.on("mouseout", fade(1));