1 function d3_raphael_enterSelection(groups, d3_raphael_root) { 2 d3_arraySubclass(groups, d3_raphael_enterSelectionPrototype); 3 groups.root = d3_raphael_root; 4 5 return groups; 6 } 7 8 var d3_raphael_enterSelectionPrototype = []; 9 10 /** 11 * See {@link D3RaphaelSelection#append} 12 * 13 * @param {string} type 14 * @return {D3RaphaelEnterSelection} this 15 * 16 * @see <code><a href="https://github.com/mbostock/d3/wiki/Selections#wiki-append">d3.selection.append()</a></code> 17 * 18 * @function 19 * @name D3RaphaelEnterSelection#append 20 */ 21 d3_raphael_enterSelectionPrototype.append = function(type) { 22 if(d3_raphael_paperShapes.indexOf(type) < 0) 23 throw TypeError("Type Not Supported"); 24 25 var groups = [], 26 group, 27 upgroup, // tricky! 28 nodeData; 29 30 for(var j = 0; j < this.length; j++) { 31 groups.push((group = [])); 32 upgroup = this[j].update; // upgroup is the enter selection's corresponding update selection 33 34 for(var i = 0; i < this[j].length; i++) { 35 if((nodeData = this[j][i])) { 36 var newNode = this.root[type](); 37 38 if("__data__" in nodeData) 39 newNode.__data__ = nodeData.__data__; 40 41 group.push(newNode); 42 upgroup[i] = newNode; // adds the new node to the update selection 43 } else { 44 group.push(null); 45 } 46 } 47 } 48 49 return d3_raphael_selection(groups, this.root); 50 }; 51 52 /** 53 * See {@link D3RaphaelSelection#empty} 54 * 55 * @see <code><a href="https://github.com/mbostock/d3/wiki/Selections#wiki-empty">d3.selection.empty()</a></code> 56 * 57 * @function 58 * @name D3RaphaelEnterSelection#empty 59 */ 60 d3_raphael_enterSelectionPrototype.empty = d3_selectionPrototype.empty; 61 62 /** 63 * See {@link D3RaphaelSelection#node} 64 * 65 * @see <code><a href="https://github.com/mbostock/d3/wiki/Selections#wiki-node">d3.selection.node()</a></code> 66 * 67 * @function 68 * @name D3RaphaelEnterSelection#node 69 */ 70 d3_raphael_enterSelectionPrototype.node = d3_selectionPrototype.node; 71 72 d3_raphael_enterSelectionPrototype.insert = throw_raphael_not_supported; 73 74 75 76