【发布时间】:2015-11-11 15:07:51
【问题描述】:
我不知道为什么我的图表在更改选择时没有更新。
这是我目前在Plunker上的代码
貌似不行的代码是:
dropDown.on("change", function() {
d3.selectAll("circle")
.data(orgData[this.value])
.attr("y", function(d) {
return height - price_scale(d.value);
})
.attr("height", function(d) {
return price_scale(d.value);
});
});
代码来自我之前查询的答案:
How to use d3 filter and update function to toggle between data selections
该代码有效,因为更新函数调整了圆形 svg 对象的参数。有没有我没有考虑到 rect 对象的参数?
【问题讨论】:
-
我没有看到任何
svg:circle元素,你的意思是rect吗?
标签: javascript d3.js svg