名前を使用してデータをフィルタリングする必要がある D3(Rickshaw フレームワーク) に取り組んでいます。
これは、人力車が円を作成するために使用するコードです。
var nodes = graph.vis.selectAll("path").data(series.stack.filter(function(d) {
return d.y !== null
})).enter().append("svg:circle").attr("cx", function(d) {
return graph.x(d.x)
}).attr("cy", function(d) {
return graph.y(d.y)
}).attr("fill-opacity", 1.0).attr('transform', 'translate(22,0)').attr("r", function(d) {
return ("r" in d) ? d.r : graph.renderer.dotSize
});
次のようにデータをフィルタリングしようとしました
$('#BestBrands input').on("change", function () {
console.log("called")
var selected = $(this).attr('name'),
display = this.checked ? "inline" : "none";
console.log(selected)
graph.vis.selectAll(".filter")
.data(series.stack.filter(function(d) {
return series.name[0] == selected
}))
.attr("display", display);
});
//series.name は d3.js の d.name と同じなので、series[0] が最初の座標名です。動作していません。クラスにクラスを追加する必要がありますか? 私はこれで明確ではありません。名前に従ってデータをフィルタリングするには、ここで何をすべきですか?