Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // you've selected a bunch of text elements that already exist on the page
- var text = svg.selectAll("text")
- .data(data); //<-- you've now bound data to them
- // text here is the elements already on the page, we just update them
- text.attr("class", "update");
- // if there's more data then previous existing elements
- // these are returned by .enter()
- text.enter().append("text")
- // now you are operating on both existing and new elements
- text.text(function(d) { return d; });
- var myCoolRect = svg.append('rect')
- .attr('id', 'myCoolRect')
- .attr('x', 100)
- ....;
- myCoolRect.attr('x', 250);
- svg.select('#myCoolRect')
- .attr('x', 100);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement