Reputation: 7782
I can't work out why my chart doesn't update when I change selection.
Here's my code so far on Plunker
The code that seemingly doesn't work is:
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);
});
});
The code comes from the answer to a previous query that I made:
How to use d3 filter and update function to toggle between data selections
That code worked because the update function tweaked the parameters of a circle svg object. Is there a parameter I've not factored in with rect objects?
Upvotes: 2
Views: 98
Reputation: 124249
circle elements don't have height or y attributes, they have cx, cy and r attributes.
Alternatively maybe you meant to select rect elements which do have height and y attributes.
Upvotes: 3