Line | |
---|
1 | <!DOCTYPE html> |
---|
2 | <html> |
---|
3 | <head> |
---|
4 | <title>Test - select > enter > append</title> |
---|
5 | <script type="text/javascript" src="../../d3.js"></script> |
---|
6 | </head> |
---|
7 | <body> |
---|
8 | <span></span> |
---|
9 | <span></span> |
---|
10 | <script type="text/javascript"> |
---|
11 | |
---|
12 | var s = d3.select("body") |
---|
13 | .selectAll("span") |
---|
14 | .data("The test passed, hooray!".split(/\b/)); |
---|
15 | |
---|
16 | // Add missing <span>s. |
---|
17 | s.enter().append("span") |
---|
18 | .append("b") |
---|
19 | .text(function(d) { return d; }); |
---|
20 | |
---|
21 | // Add missing <b>s. |
---|
22 | s.selectAll("b") |
---|
23 | .data(function(d) { return [d]; }) |
---|
24 | .enter().append("b") |
---|
25 | .text(function(d) { return d; }); |
---|
26 | |
---|
27 | </script> |
---|
28 | </body> |
---|
29 | </html> |
---|
Note: See
TracBrowser
for help on using the repository browser.