Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
MUR Drupal
d3-library
Commits
2f4d3d82
Commit
2f4d3d82
authored
Jul 05, 2013
by
Mike Bostock
Browse files
Merge branch 'enter-insert-in-order' into 3.2.4
parents
248effcd
27a7252d
Changes
11
Hide whitespace changes
Inline
Side-by-side
d3.js
View file @
2f4d3d82
...
...
@@ -490,7 +490,7 @@ d3 = function() {
subgroup
.
parentNode
=
(
group
=
this
[
j
]).
parentNode
;
for
(
var
i
=
-
1
,
n
=
group
.
length
;
++
i
<
n
;
)
{
if
(
node
=
group
[
i
])
{
subgroup
.
push
(
subnode
=
selector
.
call
(
node
,
node
.
__data__
,
i
));
subgroup
.
push
(
subnode
=
selector
.
call
(
node
,
node
.
__data__
,
i
,
j
));
if
(
subnode
&&
"
__data__
"
in
node
)
subnode
.
__data__
=
node
.
__data__
;
}
else
{
subgroup
.
push
(
null
);
...
...
@@ -510,7 +510,7 @@ d3 = function() {
for
(
var
j
=
-
1
,
m
=
this
.
length
;
++
j
<
m
;
)
{
for
(
var
group
=
this
[
j
],
i
=
-
1
,
n
=
group
.
length
;
++
i
<
n
;
)
{
if
(
node
=
group
[
i
])
{
subgroups
.
push
(
subgroup
=
d3_array
(
selector
.
call
(
node
,
node
.
__data__
,
i
)));
subgroups
.
push
(
subgroup
=
d3_array
(
selector
.
call
(
node
,
node
.
__data__
,
i
,
j
)));
subgroup
.
parentNode
=
node
;
}
}
...
...
@@ -897,7 +897,6 @@ d3 = function() {
d3
.
selection
.
enter
=
d3_selection_enter
;
d3
.
selection
.
enter
.
prototype
=
d3_selection_enterPrototype
;
d3_selection_enterPrototype
.
append
=
d3_selectionPrototype
.
append
;
d3_selection_enterPrototype
.
insert
=
d3_selectionPrototype
.
insert
;
d3_selection_enterPrototype
.
empty
=
d3_selectionPrototype
.
empty
;
d3_selection_enterPrototype
.
node
=
d3_selectionPrototype
.
node
;
d3_selection_enterPrototype
.
call
=
d3_selectionPrototype
.
call
;
...
...
@@ -910,7 +909,7 @@ d3 = function() {
subgroup
.
parentNode
=
group
.
parentNode
;
for
(
var
i
=
-
1
,
n
=
group
.
length
;
++
i
<
n
;
)
{
if
(
node
=
group
[
i
])
{
subgroup
.
push
(
upgroup
[
i
]
=
subnode
=
selector
.
call
(
group
.
parentNode
,
node
.
__data__
,
i
));
subgroup
.
push
(
upgroup
[
i
]
=
subnode
=
selector
.
call
(
group
.
parentNode
,
node
.
__data__
,
i
,
j
));
subnode
.
__data__
=
node
.
__data__
;
}
else
{
subgroup
.
push
(
null
);
...
...
@@ -919,6 +918,20 @@ d3 = function() {
}
return
d3_selection
(
subgroups
);
};
d3_selection_enterPrototype
.
insert
=
function
(
name
,
before
)
{
if
(
arguments
.
length
<
2
)
before
=
d3_selection_enterInsertBefore
(
this
);
return
d3_selectionPrototype
.
insert
.
call
(
this
,
name
,
before
);
};
function
d3_selection_enterInsertBefore
(
enter
)
{
var
i0
,
j0
;
return
function
(
d
,
i
,
j
)
{
var
group
=
enter
[
j
].
update
,
n
=
group
.
length
,
node
;
if
(
j
!=
j0
)
j0
=
j
,
i0
=
0
;
if
(
i
>=
i0
)
i0
=
i
+
1
;
while
(
!
(
node
=
group
[
i0
])
&&
++
i0
<
n
)
;
return
node
;
};
}
d3_selectionPrototype
.
transition
=
function
()
{
var
id
=
d3_transitionInheritId
||
++
d3_transitionId
,
subgroups
=
[],
subgroup
,
node
,
transition
=
Object
.
create
(
d3_transitionInherit
);
transition
.
time
=
Date
.
now
();
...
...
@@ -7443,7 +7456,7 @@ d3 = function() {
for
(
var
j
=
-
1
,
m
=
this
.
length
;
++
j
<
m
;
)
{
subgroups
.
push
(
subgroup
=
[]);
for
(
var
group
=
this
[
j
],
i
=
-
1
,
n
=
group
.
length
;
++
i
<
n
;
)
{
if
((
node
=
group
[
i
])
&&
(
subnode
=
selector
.
call
(
node
,
node
.
__data__
,
i
)))
{
if
((
node
=
group
[
i
])
&&
(
subnode
=
selector
.
call
(
node
,
node
.
__data__
,
i
,
j
)))
{
if
(
"
__data__
"
in
node
)
subnode
.
__data__
=
node
.
__data__
;
d3_transitionNode
(
subnode
,
i
,
id
,
node
.
__transition__
[
id
]);
subgroup
.
push
(
subnode
);
...
...
@@ -7461,7 +7474,7 @@ d3 = function() {
for
(
var
group
=
this
[
j
],
i
=
-
1
,
n
=
group
.
length
;
++
i
<
n
;
)
{
if
(
node
=
group
[
i
])
{
transition
=
node
.
__transition__
[
id
];
subnodes
=
selector
.
call
(
node
,
node
.
__data__
,
i
);
subnodes
=
selector
.
call
(
node
,
node
.
__data__
,
i
,
j
);
subgroups
.
push
(
subgroup
=
[]);
for
(
var
k
=
-
1
,
o
=
subnodes
.
length
;
++
k
<
o
;
)
{
if
(
subnode
=
subnodes
[
k
])
d3_transitionNode
(
subnode
,
k
,
id
,
transition
);
...
...
d3.min.js
View file @
2f4d3d82
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/selection/enter-insert.js
0 → 100644
View file @
2f4d3d82
import
"
selection
"
;
import
"
enter
"
;
d3_selection_enterPrototype
.
insert
=
function
(
name
,
before
)
{
if
(
arguments
.
length
<
2
)
before
=
d3_selection_enterInsertBefore
(
this
);
return
d3_selectionPrototype
.
insert
.
call
(
this
,
name
,
before
);
};
function
d3_selection_enterInsertBefore
(
enter
)
{
var
i0
,
j0
;
return
function
(
d
,
i
,
j
)
{
var
group
=
enter
[
j
].
update
,
n
=
group
.
length
,
node
;
if
(
j
!=
j0
)
j0
=
j
,
i0
=
0
;
if
(
i
>=
i0
)
i0
=
i
+
1
;
while
(
!
(
node
=
group
[
i0
])
&&
++
i0
<
n
);
return
node
;
};
}
src/selection/enter-select.js
View file @
2f4d3d82
...
...
@@ -15,7 +15,7 @@ d3_selection_enterPrototype.select = function(selector) {
subgroup
.
parentNode
=
group
.
parentNode
;
for
(
var
i
=
-
1
,
n
=
group
.
length
;
++
i
<
n
;)
{
if
(
node
=
group
[
i
])
{
subgroup
.
push
(
upgroup
[
i
]
=
subnode
=
selector
.
call
(
group
.
parentNode
,
node
.
__data__
,
i
));
subgroup
.
push
(
upgroup
[
i
]
=
subnode
=
selector
.
call
(
group
.
parentNode
,
node
.
__data__
,
i
,
j
));
subnode
.
__data__
=
node
.
__data__
;
}
else
{
subgroup
.
push
(
null
);
...
...
src/selection/enter.js
View file @
2f4d3d82
...
...
@@ -12,10 +12,10 @@ d3.selection.enter = d3_selection_enter;
d3
.
selection
.
enter
.
prototype
=
d3_selection_enterPrototype
;
d3_selection_enterPrototype
.
append
=
d3_selectionPrototype
.
append
;
d3_selection_enterPrototype
.
insert
=
d3_selectionPrototype
.
insert
;
d3_selection_enterPrototype
.
empty
=
d3_selectionPrototype
.
empty
;
d3_selection_enterPrototype
.
node
=
d3_selectionPrototype
.
node
;
d3_selection_enterPrototype
.
call
=
d3_selectionPrototype
.
call
;
d3_selection_enterPrototype
.
size
=
d3_selectionPrototype
.
size
;
import
"
enter-select
"
;
import
"
enter-insert
"
;
src/selection/select.js
View file @
2f4d3d82
...
...
@@ -14,7 +14,7 @@ d3_selectionPrototype.select = function(selector) {
subgroup
.
parentNode
=
(
group
=
this
[
j
]).
parentNode
;
for
(
var
i
=
-
1
,
n
=
group
.
length
;
++
i
<
n
;)
{
if
(
node
=
group
[
i
])
{
subgroup
.
push
(
subnode
=
selector
.
call
(
node
,
node
.
__data__
,
i
));
subgroup
.
push
(
subnode
=
selector
.
call
(
node
,
node
.
__data__
,
i
,
j
));
if
(
subnode
&&
"
__data__
"
in
node
)
subnode
.
__data__
=
node
.
__data__
;
}
else
{
subgroup
.
push
(
null
);
...
...
src/selection/selectAll.js
View file @
2f4d3d82
...
...
@@ -11,7 +11,7 @@ d3_selectionPrototype.selectAll = function(selector) {
for
(
var
j
=
-
1
,
m
=
this
.
length
;
++
j
<
m
;)
{
for
(
var
group
=
this
[
j
],
i
=
-
1
,
n
=
group
.
length
;
++
i
<
n
;)
{
if
(
node
=
group
[
i
])
{
subgroups
.
push
(
subgroup
=
d3_array
(
selector
.
call
(
node
,
node
.
__data__
,
i
)));
subgroups
.
push
(
subgroup
=
d3_array
(
selector
.
call
(
node
,
node
.
__data__
,
i
,
j
)));
subgroup
.
parentNode
=
node
;
}
}
...
...
src/transition/select.js
View file @
2f4d3d82
...
...
@@ -13,7 +13,7 @@ d3_transitionPrototype.select = function(selector) {
for
(
var
j
=
-
1
,
m
=
this
.
length
;
++
j
<
m
;)
{
subgroups
.
push
(
subgroup
=
[]);
for
(
var
group
=
this
[
j
],
i
=
-
1
,
n
=
group
.
length
;
++
i
<
n
;)
{
if
((
node
=
group
[
i
])
&&
(
subnode
=
selector
.
call
(
node
,
node
.
__data__
,
i
)))
{
if
((
node
=
group
[
i
])
&&
(
subnode
=
selector
.
call
(
node
,
node
.
__data__
,
i
,
j
)))
{
if
(
"
__data__
"
in
node
)
subnode
.
__data__
=
node
.
__data__
;
d3_transitionNode
(
subnode
,
i
,
id
,
node
.
__transition__
[
id
]);
subgroup
.
push
(
subnode
);
...
...
src/transition/selectAll.js
View file @
2f4d3d82
...
...
@@ -16,7 +16,7 @@ d3_transitionPrototype.selectAll = function(selector) {
for
(
var
group
=
this
[
j
],
i
=
-
1
,
n
=
group
.
length
;
++
i
<
n
;)
{
if
(
node
=
group
[
i
])
{
transition
=
node
.
__transition__
[
id
];
subnodes
=
selector
.
call
(
node
,
node
.
__data__
,
i
);
subnodes
=
selector
.
call
(
node
,
node
.
__data__
,
i
,
j
);
subgroups
.
push
(
subgroup
=
[]);
for
(
var
k
=
-
1
,
o
=
subnodes
.
length
;
++
k
<
o
;)
{
if
(
subnode
=
subnodes
[
k
])
d3_transitionNode
(
subnode
,
k
,
id
,
transition
);
...
...
test/selection/append-test.js
View file @
2f4d3d82
...
...
@@ -100,6 +100,24 @@ suite.addBatch({
}
});
suite
.
addBatch
({
"
enter-append
"
:
{
topic
:
load
(
"
selection/selection
"
).
document
(),
"
on a page with existing elements
"
:
{
topic
:
function
(
d3
)
{
var
body
=
d3
.
select
(
"
body
"
);
body
.
selectAll
(
"
div
"
).
data
([
"
apple
"
,
"
orange
"
]).
enter
().
append
(
"
div
"
);
return
body
;
},
"
appends to the end of the parent
"
:
function
(
body
)
{
var
data
=
[
"
peach
"
,
"
apple
"
,
"
banana
"
,
"
orange
"
,
"
apricot
"
];
body
.
selectAll
(
"
div
"
).
data
(
data
,
String
).
enter
().
append
(
"
div
"
);
assert
.
deepEqual
(
body
.
selectAll
(
"
div
"
).
data
(),
[
"
apple
"
,
"
orange
"
,
"
peach
"
,
"
banana
"
,
"
apricot
"
]);
}
}
}
});
suite
.
addBatch
({
"
selectAll(div).data(…).enter()
"
:
{
topic
:
load
(
"
selection/selection
"
).
document
(),
...
...
test/selection/insert-test.js
View file @
2f4d3d82
...
...
@@ -110,6 +110,24 @@ suite.addBatch({
}
});
suite
.
addBatch
({
"
enter-insert
"
:
{
topic
:
load
(
"
selection/selection
"
).
document
(),
"
on a page with existing elements
"
:
{
topic
:
function
(
d3
)
{
var
body
=
d3
.
select
(
"
body
"
);
body
.
selectAll
(
"
div
"
).
data
([
"
apple
"
,
"
orange
"
]).
enter
().
append
(
"
div
"
);
return
body
;
},
"
inserts before the following updating sibling
"
:
function
(
body
)
{
var
data
=
[
"
peach
"
,
"
apple
"
,
"
apple2
"
,
"
apple3
"
,
"
banana
"
,
"
orange
"
,
"
apricot
"
];
body
.
selectAll
(
"
div
"
).
data
(
data
,
String
).
enter
().
insert
(
"
div
"
);
assert
.
deepEqual
(
body
.
selectAll
(
"
div
"
).
data
(),
data
);
}
}
}
});
suite
.
addBatch
({
"
selectAll(div).data(…).enter()
"
:
{
topic
:
load
(
"
selection/selection
"
).
document
(),
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment