Quick question about data connection. Let's say I have some elements, each of which has a. When I first join the data, it is automatically inherited by the elements that I add to the input selection.
When the data changes, and I rewrite it, I expected the elements to receive new data, but this did not happen.
To handle this, I needed to explicitly reconfigure the data at the lower level as follows:
gElements.selectAll("circle") .data(function(d) { return [d]; } .enter().append("circle");
This handles both the creation case and the subsequent re-binding. But this seems unnecessary, since the return of [d] is mainly automatic with the initial inheritance of data from the parent element.
Is this approach the right way to handle this, or am I embarrassed somewhere?
Scott Cameron
source share