Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
MUR Drupal
d3-library
Commits
044f6150
Commit
044f6150
authored
Oct 05, 2012
by
Mike Bostock
Browse files
Merge branch 'transition-reselect' into 2.11
parents
019583e3
09297b09
Changes
37
Expand all
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
044f6150
...
...
@@ -7,14 +7,14 @@ JS_TESTER = $(NODE_PATH)/vows/bin/vows
LOCALE
?=
en_US
all
:
\
d3.v
2
.js
\
d3.v
2
.min.js
\
d3.v
3
.js
\
d3.v
3
.min.js
\
component.json
\
package.json
# Modify this rule to build your own custom release.
.INTERMEDIATE d3.v
2
.js
:
\
.INTERMEDIATE d3.v
3
.js
:
\
src/start.js
\
d3.core.js
\
d3.scale.js
\
...
...
@@ -124,6 +124,7 @@ d3.core.js: \
src/core/transition-duration.js
\
src/core/transition-each.js
\
src/core/transition-transition.js
\
src/core/transition-tween.js
\
src/core/tween.js
\
src/core/timer.js
\
src/core/mouse.js
\
...
...
component.json
View file @
044f6150
{
"name"
:
"d3"
,
"version"
:
"
2.10.2
"
,
"version"
:
"
3.0.0pre
"
,
"main"
:
"./d3.v2.js"
}
d3.v2.min.js
deleted
100644 → 0
View file @
019583e3
This diff is collapsed.
Click to expand it.
d3.v
2
.js
→
d3.v
3
.js
View file @
044f6150
...
...
@@ -136,8 +136,17 @@
return
.
5
*
(
t
<
.
5
?
f
(
2
*
t
)
:
2
-
f
(
2
-
2
*
t
));
};
}
function
d3_ease_identity
(
t
)
{
return
t
;
function
d3_ease_quad
(
t
)
{
return
t
*
t
;
}
function
d3_ease_cubic
(
t
)
{
return
t
*
t
*
t
;
}
function
d3_ease_cubicInOut
(
t
)
{
if
(
t
<=
0
)
return
0
;
if
(
t
>=
1
)
return
1
;
var
t2
=
t
*
t
,
t3
=
t2
*
t
;
return
4
*
(
t
<
.
5
?
t3
:
3
*
(
t
-
t2
)
+
t3
-
.
75
);
}
function
d3_ease_poly
(
e
)
{
return
function
(
t
)
{
...
...
@@ -537,14 +546,9 @@
}
function
d3_transition
(
groups
,
id
,
time
)
{
d3_arraySubclass
(
groups
,
d3_transitionPrototype
);
var
tweens
=
new
d3_Map
,
event
=
d3
.
dispatch
(
"
start
"
,
"
end
"
),
ease
=
d3_transitionEase
;
var
event
=
d3
.
dispatch
(
"
start
"
,
"
end
"
),
ease
=
d3_transitionEase
;
groups
.
id
=
id
;
groups
.
time
=
time
;
groups
.
tween
=
function
(
name
,
tween
)
{
if
(
arguments
.
length
<
2
)
return
tweens
.
get
(
name
);
if
(
tween
==
null
)
tweens
.
remove
(
name
);
else
tweens
.
set
(
name
,
tween
);
return
groups
;
};
groups
.
ease
=
function
(
value
)
{
if
(
!
arguments
.
length
)
return
ease
;
ease
=
typeof
value
===
"
function
"
?
value
:
d3
.
ease
.
apply
(
d3
,
arguments
);
...
...
@@ -560,7 +564,7 @@
function
start
(
elapsed
)
{
if
(
lock
.
active
>
id
)
return
stop
();
lock
.
active
=
id
;
tween
s
.
forEach
(
function
(
key
,
value
)
{
transition
.
tween
.
forEach
(
function
(
key
,
value
)
{
if
(
value
=
value
.
call
(
node
,
d
,
i
))
{
tweened
.
push
(
value
);
}
...
...
@@ -584,27 +588,36 @@
}
}
function
stop
()
{
if
(
!
--
lock
.
count
)
delete
node
.
__transition__
;
if
(
--
lock
.
count
)
delete
lock
[
id
];
else
delete
node
.
__transition__
;
return
1
;
}
var
tweened
=
[],
delay
=
node
.
delay
,
duration
=
node
.
duration
,
lock
=
(
node
=
node
.
node
).
__transition__
||
(
node
.
__transition__
=
{
active
:
0
,
count
:
0
}),
d
=
node
.
__data__
;
++
lock
.
count
;
var
d
=
node
.
__data__
,
lock
=
node
.
__transition__
,
transition
=
lock
[
id
],
delay
=
transition
.
delay
,
duration
=
transition
.
duration
,
tweened
=
[];
delay
<=
elapsed
?
start
(
elapsed
)
:
d3
.
timer
(
start
,
delay
,
time
);
});
},
0
,
time
);
return
groups
;
}
function
d3_transitionNode
(
node
,
id
,
delay
,
duration
)
{
var
lock
=
node
.
__transition__
||
(
node
.
__transition__
=
{
active
:
0
,
count
:
0
});
lock
[
id
]
||
(
lock
[
id
]
=
{
delay
:
delay
,
duration
:
duration
,
tween
:
new
d3_Map
});
++
lock
.
count
;
}
function
d3_transition_each
(
callback
)
{
var
id
=
d3_transitionId
,
ease
=
d3_transitionEase
,
delay
=
d3_transitionDelay
,
duration
=
d3_transitionDuration
;
d3_transitionId
=
this
.
id
;
d3_transitionEase
=
this
.
ease
();
d3_selection_each
(
this
,
function
(
node
,
i
,
j
)
{
d3_transitionDelay
=
node
.
delay
;
d3_transitionDuration
=
node
.
duration
;
callback
.
call
(
node
=
node
.
node
,
node
.
__data__
,
i
,
j
);
var
transition
=
node
.
__transition__
[
d3_transitionId
];
d3_transitionDelay
=
transition
.
delay
;
d3_transitionDuration
=
transition
.
duration
;
callback
.
call
(
node
,
node
.
__data__
,
i
,
j
);
});
d3_transitionId
=
id
;
d3_transitionEase
=
ease
;
...
...
@@ -641,6 +654,7 @@
var
t0
=
null
,
t1
=
d3_timer_queue
,
then
=
Infinity
;
while
(
t1
)
{
if
(
t1
.
flush
)
{
delete
d3_timer_byId
[
t1
.
callback
.
id
];
t1
=
t0
?
t0
.
next
=
t1
.
next
:
d3_timer_queue
=
t1
.
next
;
}
else
{
then
=
Math
.
min
(
then
,
t1
.
then
+
t1
.
delay
);
...
...
@@ -2593,7 +2607,7 @@
};
}
d3
=
{
version
:
"
2.10.2
"
version
:
"
3.0.0pre
"
};
var
d3_array
=
d3_arraySlice
;
try
{
...
...
@@ -3128,8 +3142,8 @@
}
return
d3_formatPrefixes
[
8
+
i
/
3
];
};
var
d3_ease_quad
=
d3_ease_poly
(
2
),
d3_ease_cubic
=
d3_ease_poly
(
3
),
d3_ease_default
=
function
()
{
return
d3_
ease_
identity
;
var
d3_ease_default
=
function
()
{
return
d3_identity
;
};
var
d3_ease
=
d3
.
map
({
linear
:
d3_ease_default
,
...
...
@@ -3156,7 +3170,7 @@
}
});
var
d3_ease_mode
=
d3
.
map
({
"
in
"
:
d3_
ease_
identity
,
"
in
"
:
d3_identity
,
out
:
d3_ease_reverse
,
"
in-out
"
:
d3_ease_reflect
,
"
out-in
"
:
function
(
f
)
{
...
...
@@ -3166,7 +3180,7 @@
d3
.
ease
=
function
(
name
)
{
var
i
=
name
.
indexOf
(
"
-
"
),
t
=
i
>=
0
?
name
.
substring
(
0
,
i
)
:
name
,
m
=
i
>=
0
?
name
.
substring
(
i
+
1
)
:
"
in
"
;
t
=
d3_ease
.
get
(
t
)
||
d3_ease_default
;
m
=
d3_ease_mode
.
get
(
m
)
||
d3_
ease_
identity
;
m
=
d3_ease_mode
.
get
(
m
)
||
d3_identity
;
return
d3_ease_clamp
(
m
(
t
.
apply
(
null
,
Array
.
prototype
.
slice
.
call
(
arguments
,
1
))));
};
d3
.
event
=
null
;
...
...
@@ -3917,18 +3931,15 @@
return
null
;
};
d3_selectionPrototype
.
transition
=
function
()
{
var
subgroups
=
[],
subgroup
,
node
;
var
id
=
d3_transitionId
||
++
d3_transitionNextId
,
subgroups
=
[],
subgroup
,
node
,
transition
;
for
(
var
j
=
-
1
,
m
=
this
.
length
;
++
j
<
m
;
)
{
subgroups
.
push
(
subgroup
=
[]);
for
(
var
group
=
this
[
j
],
i
=
-
1
,
n
=
group
.
length
;
++
i
<
n
;
)
{
subgroup
.
push
((
node
=
group
[
i
])
?
{
node
:
node
,
delay
:
d3_transitionDelay
,
duration
:
d3_transitionDuration
}
:
null
);
if
(
node
=
group
[
i
])
d3_transitionNode
(
node
,
id
,
d3_transitionDelay
,
d3_transitionDuration
);
subgroup
.
push
(
node
);
}
}
return
d3_transition
(
subgroups
,
d3_transitionId
||
++
d3_transitionNextI
d
,
Date
.
now
());
return
d3_transition
(
subgroups
,
i
d
,
Date
.
now
());
};
var
d3_selectionRoot
=
d3_selection
([
[
document
]
]);
d3_selectionRoot
[
0
].
parentNode
=
d3_selectRoot
;
...
...
@@ -3962,51 +3973,49 @@
}
return
d3_selection
(
subgroups
);
};
var
d3_transitionPrototype
=
[],
d3_transitionNextId
=
0
,
d3_transitionId
=
0
,
d3_transitionDefaultDelay
=
0
,
d3_transitionDefaultDuration
=
250
,
d3_transitionDefaultEase
=
d3
.
ease
(
"
cubic-in-out
"
),
d3_transitionDelay
=
d3_transitionDefaultDelay
,
d3_transitionDuration
=
d3_transitionDefaultDuration
,
d3_transitionEase
=
d3_
transitionDefaultEase
;
var
d3_transitionPrototype
=
[],
d3_transitionNextId
=
0
,
d3_transitionId
=
0
,
d3_transitionDefaultDelay
=
0
,
d3_transitionDefaultDuration
=
250
,
d3_transitionDelay
=
d3_transitionDefaultDelay
,
d3_transitionDuration
=
d3_transitionDefaultDuration
,
d3_transitionEase
=
d3_
ease_cubicInOut
;
d3_transitionPrototype
.
call
=
d3_selectionPrototype
.
call
;
d3_transitionPrototype
.
empty
=
d3_selectionPrototype
.
empty
;
d3_transitionPrototype
.
node
=
d3_selectionPrototype
.
node
;
d3
.
transition
=
function
(
selection
)
{
return
arguments
.
length
?
d3_transitionId
?
selection
.
transition
()
:
selection
:
d3_selectionRoot
.
transition
();
};
d3
.
transition
.
prototype
=
d3_transitionPrototype
;
d3_transitionPrototype
.
select
=
function
(
selector
)
{
var
subgroups
=
[],
subgroup
,
subnode
,
node
;
var
id
=
this
.
id
,
subgroups
=
[],
subgroup
,
subnode
,
node
,
transition
;
if
(
typeof
selector
!==
"
function
"
)
selector
=
d3_selection_selector
(
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
,
node
.
node
.
__data__
,
i
)))
{
if
(
"
__data__
"
in
node
.
node
)
subnode
.
__data__
=
node
.
node
.
__data__
;
subgroup
.
push
({
node
:
subnode
,
delay
:
node
.
delay
,
duration
:
node
.
duration
});
if
((
node
=
group
[
i
])
&&
(
subnode
=
selector
.
call
(
node
,
node
.
__data__
,
i
)))
{
if
(
"
__data__
"
in
node
)
subnode
.
__data__
=
node
.
__data__
;
transition
=
node
.
__transition__
[
id
];
d3_transitionNode
(
subnode
,
id
,
transition
.
delay
,
transition
.
duration
);
subgroup
.
push
(
subnode
);
}
else
{
subgroup
.
push
(
null
);
}
}
}
return
d3_transition
(
subgroups
,
this
.
id
,
this
.
time
).
ease
(
this
.
ease
());
return
d3_transition
(
subgroups
,
id
,
this
.
time
).
ease
(
this
.
ease
());
};
d3_transitionPrototype
.
selectAll
=
function
(
selector
)
{
var
subgroups
=
[],
subgroup
,
subnodes
,
node
;
var
id
=
this
.
id
,
subgroups
=
[],
subgroup
,
subnodes
,
node
,
subnode
,
transition
;
if
(
typeof
selector
!==
"
function
"
)
selector
=
d3_selection_selectorAll
(
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
])
{
subnodes
=
selector
.
call
(
node
.
node
,
node
.
node
.
__data__
,
i
);
transition
=
node
.
__transition__
[
id
];
subnodes
=
selector
.
call
(
node
,
node
.
__data__
,
i
);
subgroups
.
push
(
subgroup
=
[]);
for
(
var
k
=
-
1
,
o
=
subnodes
.
length
;
++
k
<
o
;
)
{
subgroup
.
push
({
node
:
subnodes
[
k
],
delay
:
node
.
delay
,
duration
:
node
.
duration
});
d3_transitionNode
(
subnode
=
subnodes
[
k
],
id
,
transition
.
delay
,
transition
.
duration
);
subgroup
.
push
(
subnode
);
}
}
}
}
return
d3_transition
(
subgroups
,
this
.
id
,
this
.
time
).
ease
(
this
.
ease
());
return
d3_transition
(
subgroups
,
id
,
this
.
time
).
ease
(
this
.
ease
());
};
d3_transitionPrototype
.
filter
=
function
(
filter
)
{
var
subgroups
=
[],
subgroup
,
group
,
node
;
...
...
@@ -4014,7 +4023,7 @@
for
(
var
j
=
0
,
m
=
this
.
length
;
j
<
m
;
j
++
)
{
subgroups
.
push
(
subgroup
=
[]);
for
(
var
group
=
this
[
j
],
i
=
0
,
n
=
group
.
length
;
i
<
n
;
i
++
)
{
if
((
node
=
group
[
i
])
&&
filter
.
call
(
node
.
node
,
node
.
node
.
__data__
,
i
))
{
if
((
node
=
group
[
i
])
&&
filter
.
call
(
node
,
node
.
__data__
,
i
))
{
subgroup
.
push
(
node
);
}
}
...
...
@@ -4077,21 +4086,43 @@
});
};
d3_transitionPrototype
.
delay
=
function
(
value
)
{
var
id
=
this
.
id
;
return
d3_selection_each
(
this
,
typeof
value
===
"
function
"
?
function
(
node
,
i
,
j
)
{
node
.
delay
=
value
.
call
(
node
=
node
.
node
,
node
.
__data__
,
i
,
j
)
|
0
;
}
:
(
value
=
value
|
0
,
function
(
node
)
{
node
.
delay
=
value
;
node
.
__transition__
[
id
].
delay
=
value
.
call
(
node
,
node
.
__data__
,
i
,
j
)
|
0
;
}
:
(
value
|
=
0
,
function
(
node
)
{
node
.
__transition__
[
id
].
delay
=
value
;
}));
};
d3_transitionPrototype
.
duration
=
function
(
value
)
{
var
id
=
this
.
id
;
return
d3_selection_each
(
this
,
typeof
value
===
"
function
"
?
function
(
node
,
i
,
j
)
{
node
.
duration
=
Math
.
max
(
1
,
value
.
call
(
node
=
node
.
node
,
node
.
__data__
,
i
,
j
)
|
0
);
node
.
__transition__
[
id
].
duration
=
Math
.
max
(
1
,
value
.
call
(
node
,
node
.
__data__
,
i
,
j
)
|
0
);
}
:
(
value
=
Math
.
max
(
1
,
value
|
0
),
function
(
node
)
{
node
.
duration
=
value
;
node
.
__transition__
[
id
].
duration
=
value
;
}));
};
d3_transitionPrototype
.
transition
=
function
()
{
return
this
.
select
(
d3_this
);
var
id0
=
this
.
id
,
id1
=
++
d3_transitionNextId
,
subgroups
=
[],
subgroup
,
group
,
node
,
transition
;
for
(
var
j
=
0
,
m
=
this
.
length
;
j
<
m
;
j
++
)
{
subgroups
.
push
(
subgroup
=
[]);
for
(
var
group
=
this
[
j
],
i
=
0
,
n
=
group
.
length
;
i
<
n
;
i
++
)
{
if
(
node
=
group
[
i
])
{
transition
=
node
.
__transition__
[
id0
];
d3_transitionNode
(
node
,
id1
,
transition
.
delay
+
transition
.
duration
,
transition
.
duration
);
}
subgroup
.
push
(
node
);
}
}
return
d3_transition
(
subgroups
,
id1
,
this
.
time
).
ease
(
this
.
ease
());
};
d3_transitionPrototype
.
tween
=
function
(
name
,
tween
)
{
var
id
=
this
.
id
;
if
(
arguments
.
length
<
2
)
return
this
.
node
().
__transition__
[
id
].
tween
.
get
(
name
);
return
d3_selection_each
(
this
,
tween
==
null
?
function
(
node
)
{
node
.
__transition__
[
id
].
tween
.
remove
(
name
);
}
:
function
(
node
)
{
node
.
__transition__
[
id
].
tween
.
set
(
name
,
tween
);
});
};
d3
.
tween
=
function
(
b
,
interpolate
)
{
function
tweenFunction
(
d
,
i
,
a
)
{
...
...
@@ -4104,24 +4135,17 @@
return
typeof
b
===
"
function
"
?
tweenFunction
:
b
==
null
?
d3_tweenNull
:
(
b
+=
""
,
tweenString
);
};
var
d3_tweenRemove
=
{};
var
d3_timer_queue
=
null
,
d3_timer_interval
,
d3_timer_timeout
;
var
d3_timer_id
=
0
,
d3_timer_byId
=
{},
d3_timer_queue
=
null
,
d3_timer_interval
,
d3_timer_timeout
;
d3
.
timer
=
function
(
callback
,
delay
,
then
)
{
var
found
=
false
,
t0
,
t1
=
d3_timer_queue
;
if
(
arguments
.
length
<
3
)
{
if
(
arguments
.
length
<
2
)
delay
=
0
;
else
if
(
!
isFinite
(
delay
))
return
;
then
=
Date
.
now
();
}
while
(
t1
)
{
if
(
t1
.
callback
===
callback
)
{
t1
.
then
=
then
;
t1
.
delay
=
delay
;
found
=
true
;
break
;
}
t0
=
t1
;
t1
=
t1
.
next
;
}
if
(
!
found
)
d3_timer_queue
=
{
var
timer
=
d3_timer_byId
[
callback
.
id
];
if
(
timer
&&
timer
.
callback
===
callback
)
{
timer
.
then
=
then
;
timer
.
delay
=
delay
;
}
else
d3_timer_byId
[
callback
.
id
=
++
d3_timer_id
]
=
d3_timer_queue
=
{
callback
:
callback
,
then
:
then
,
delay
:
delay
,
...
...
@@ -4444,7 +4468,7 @@
textEnter
.
attr
(
"
y
"
,
Math
.
max
(
tickMajorSize
,
0
)
+
tickPadding
);
lineUpdate
.
attr
(
"
x2
"
,
0
).
attr
(
"
y2
"
,
tickMajorSize
);
textUpdate
.
attr
(
"
x
"
,
0
).
attr
(
"
y
"
,
Math
.
max
(
tickMajorSize
,
0
)
+
tickPadding
);
text
.
attr
(
"
dy
"
,
"
.71em
"
).
attr
(
"
text-anchor
"
,
"
middle
"
);
text
.
attr
(
"
dy
"
,
"
.71em
"
).
style
(
"
text-anchor
"
,
"
middle
"
);
pathUpdate
.
attr
(
"
d
"
,
"
M
"
+
range
[
0
]
+
"
,
"
+
tickEndSize
+
"
V0H
"
+
range
[
1
]
+
"
V
"
+
tickEndSize
);
break
;
}
...
...
@@ -4457,7 +4481,7 @@
textEnter
.
attr
(
"
y
"
,
-
(
Math
.
max
(
tickMajorSize
,
0
)
+
tickPadding
));
lineUpdate
.
attr
(
"
x2
"
,
0
).
attr
(
"
y2
"
,
-
tickMajorSize
);
textUpdate
.
attr
(
"
x
"
,
0
).
attr
(
"
y
"
,
-
(
Math
.
max
(
tickMajorSize
,
0
)
+
tickPadding
));
text
.
attr
(
"
dy
"
,
"
0em
"
).
attr
(
"
text-anchor
"
,
"
middle
"
);
text
.
attr
(
"
dy
"
,
"
0em
"
).
style
(
"
text-anchor
"
,
"
middle
"
);
pathUpdate
.
attr
(
"
d
"
,
"
M
"
+
range
[
0
]
+
"
,
"
+
-
tickEndSize
+
"
V0H
"
+
range
[
1
]
+
"
V
"
+
-
tickEndSize
);
break
;
}
...
...
@@ -4470,7 +4494,7 @@
textEnter
.
attr
(
"
x
"
,
-
(
Math
.
max
(
tickMajorSize
,
0
)
+
tickPadding
));
lineUpdate
.
attr
(
"
x2
"
,
-
tickMajorSize
).
attr
(
"
y2
"
,
0
);
textUpdate
.
attr
(
"
x
"
,
-
(
Math
.
max
(
tickMajorSize
,
0
)
+
tickPadding
)).
attr
(
"
y
"
,
0
);
text
.
attr
(
"
dy
"
,
"
.32em
"
).
attr
(
"
text-anchor
"
,
"
end
"
);
text
.
attr
(
"
dy
"
,
"
.32em
"
).
style
(
"
text-anchor
"
,
"
end
"
);
pathUpdate
.
attr
(
"
d
"
,
"
M
"
+
-
tickEndSize
+
"
,
"
+
range
[
0
]
+
"
H0V
"
+
range
[
1
]
+
"
H
"
+
-
tickEndSize
);
break
;
}
...
...
@@ -4483,7 +4507,7 @@
textEnter
.
attr
(
"
x
"
,
Math
.
max
(
tickMajorSize
,
0
)
+
tickPadding
);
lineUpdate
.
attr
(
"
x2
"
,
tickMajorSize
).
attr
(
"
y2
"
,
0
);
textUpdate
.
attr
(
"
x
"
,
Math
.
max
(
tickMajorSize
,
0
)
+
tickPadding
).
attr
(
"
y
"
,
0
);
text
.
attr
(
"
dy
"
,
"
.32em
"
).
attr
(
"
text-anchor
"
,
"
start
"
);
text
.
attr
(
"
dy
"
,
"
.32em
"
).
style
(
"
text-anchor
"
,
"
start
"
);
pathUpdate
.
attr
(
"
d
"
,
"
M
"
+
tickEndSize
+
"
,
"
+
range
[
0
]
+
"
H0V
"
+
range
[
1
]
+
"
H
"
+
tickEndSize
);
break
;
}
...
...
d3.v3.min.js
0 → 100644
View file @
044f6150
This diff is collapsed.
Click to expand it.
examples/stream/stack.js
View file @
044f6150
...
...
@@ -81,15 +81,9 @@ function transitionGroup() {
.
delay
(
function
(
d
,
i
)
{
return
(
i
%
m
)
*
10
;
})
.
attr
(
"
x
"
,
function
(
d
,
i
)
{
return
x
({
x
:
.
9
*
~~
(
i
/
m
)
/
n
});
})
.
attr
(
"
width
"
,
x
({
x
:
.
9
/
n
}))
.
each
(
"
end
"
,
transitionEnd
);
function
transitionEnd
()
{
d3
.
select
(
this
)
.
transition
()
.
duration
(
500
)
.
attr
(
"
y
"
,
function
(
d
)
{
return
height
-
y2
(
d
);
})
.
attr
(
"
height
"
,
y2
);
}
.
transition
()
.
attr
(
"
y
"
,
function
(
d
)
{
return
height
-
y2
(
d
);
})
.
attr
(
"
height
"
,
y2
);
}
function
transitionStack
()
{
...
...
@@ -107,13 +101,7 @@ function transitionStack() {
.
delay
(
function
(
d
,
i
)
{
return
(
i
%
m
)
*
10
;
})
.
attr
(
"
y
"
,
y1
)
.
attr
(
"
height
"
,
function
(
d
)
{
return
y0
(
d
)
-
y1
(
d
);
})
.
each
(
"
end
"
,
transitionEnd
);
function
transitionEnd
()
{
d3
.
select
(
this
)
.
transition
()
.
duration
(
500
)
.
attr
(
"
x
"
,
0
)
.
attr
(
"
width
"
,
x
({
x
:
.
9
}));
}
.
transition
()
.
attr
(
"
x
"
,
0
)
.
attr
(
"
width
"
,
x
({
x
:
.
9
}));
}
package.json
View file @
044f6150
{
"name"
:
"d3"
,
"version"
:
"
2.10.2
"
,
"version"
:
"
3.0.0pre
"
,
"description"
:
"A small, free JavaScript library for manipulating documents based on data."
,
"keywords"
:
[
"dom"
,
...
...
@@ -22,7 +22,7 @@
"main"
:
"index.js"
,
"browserify"
:
"index-browserify.js"
,
"jam"
:
{
"main"
:
"d3.v
2
.js"
,
"main"
:
"d3.v
3
.js"
,
"shim"
:
{
"exports"
:
"d3"
}
...
...
src/core/core.js
View file @
044f6150
d3
=
{
version
:
"
2.10.2
"
};
// semver
d3
=
{
version
:
"
3.0.0pre
"
};
// semver
src/core/ease.js
View file @
044f6150
...
...
@@ -33,9 +33,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
var
d3_ease_quad
=
d3_ease_poly
(
2
),
d3_ease_cubic
=
d3_ease_poly
(
3
),
d3_ease_default
=
function
()
{
return
d3_ease_identity
;
};
var
d3_ease_default
=
function
()
{
return
d3_identity
;
};
var
d3_ease
=
d3
.
map
({
linear
:
d3_ease_default
,
...
...
@@ -51,7 +49,7 @@ var d3_ease = d3.map({
});
var
d3_ease_mode
=
d3
.
map
({
"
in
"
:
d3_
ease_
identity
,
"
in
"
:
d3_identity
,
"
out
"
:
d3_ease_reverse
,
"
in-out
"
:
d3_ease_reflect
,
"
out-in
"
:
function
(
f
)
{
return
d3_ease_reflect
(
d3_ease_reverse
(
f
));
}
...
...
@@ -62,7 +60,7 @@ d3.ease = function(name) {
t
=
i
>=
0
?
name
.
substring
(
0
,
i
)
:
name
,
m
=
i
>=
0
?
name
.
substring
(
i
+
1
)
:
"
in
"
;
t
=
d3_ease
.
get
(
t
)
||
d3_ease_default
;
m
=
d3_ease_mode
.
get
(
m
)
||
d3_
ease_
identity
;
m
=
d3_ease_mode
.
get
(
m
)
||
d3_identity
;
return
d3_ease_clamp
(
m
(
t
.
apply
(
null
,
Array
.
prototype
.
slice
.
call
(
arguments
,
1
))));
};
...
...
@@ -84,8 +82,20 @@ function d3_ease_reflect(f) {
};
}
function
d3_ease_identity
(
t
)
{
return
t
;
function
d3_ease_quad
(
t
)
{
return
t
*
t
;
}
function
d3_ease_cubic
(
t
)
{
return
t
*
t
*
t
;
}
// Optimized clamp(reflect(poly(3))).
function
d3_ease_cubicInOut
(
t
)
{
if
(
t
<=
0
)
return
0
;
if
(
t
>=
1
)
return
1
;
var
t2
=
t
*
t
,
t3
=
t2
*
t
;
return
4
*
(
t
<
.
5
?
t3
:
3
*
(
t
-
t2
)
+
t3
-
.
75
);
}
function
d3_ease_poly
(
e
)
{
...
...
src/core/selection-transition.js
View file @
044f6150
d3_selectionPrototype
.
transition
=
function
()
{
var
subgroups
=
[],
var
id
=
d3_transitionId
||
++
d3_transitionNextId
,
subgroups
=
[],
subgroup
,
node
;
node
,
transition
;
for
(
var
j
=
-
1
,
m
=
this
.
length
;
++
j
<
m
;)
{
subgroups
.
push
(
subgroup
=
[]);
for
(
var
group
=
this
[
j
],
i
=
-
1
,
n
=
group
.
length
;
++
i
<
n
;)
{
subgroup
.
push
((
node
=
group
[
i
])
?
{
node
:
node
,
delay
:
d3_transitionDelay
,
duration
:
d3_transitionDuration
}
:
null
);
if
(
node
=
group
[
i
])
d3_transitionNode
(
node
,
id
,
d3_transitionDelay
,
d3_transitionDuration
);
subgroup
.
push
(
node
);
}
}
return
d3_transition
(
subgroups
,
d3_transitionId
||
++
d3_transitionNextI
d
,
Date
.
now
());
return
d3_transition
(
subgroups
,
i
d
,
Date
.
now
());
};
src/core/timer.js
View file @
044f6150
var
d3_timer_queue
=
null
,
var
d3_timer_id
=
0
,
d3_timer_byId
=
{},
d3_timer_queue
=
null
,
d3_timer_interval
,
// is an interval (or frame) active?
d3_timer_timeout
;
// is a timeout active?
// The timer will continue to fire until callback returns true.
d3
.
timer
=
function
(
callback
,
delay
,
then
)
{
var
found
=
false
,
t0
,
t1
=
d3_timer_queue
;
if
(
arguments
.
length
<
3
)
{
if
(
arguments
.
length
<
2
)
delay
=
0
;
else
if
(
!
isFinite
(
delay
))
return
;
then
=
Date
.
now
();
}
// See if the callback's already in the queue.
while
(
t1
)
{
if
(
t1
.
callback
===
callback
)
{
t1
.
then
=
then
;
t1
.
delay
=
delay
;
found
=
true
;
break
;
}
t0
=
t1
;
t1
=
t1
.
next
;
// If the callback's already in the queue, update it.
var
timer
=
d3_timer_byId
[
callback
.
id
];
if
(
timer
&&
timer
.
callback
===
callback
)
{
timer
.
then
=
then
;
timer
.
delay
=
delay
;
}
// Otherwise, add the callback to the queue.
if
(
!
found
)
d3_timer_queue
=
{
else
d3_timer_byId
[
callback
.
id
=
++
d3_timer_id
]
=
d3_timer_queue
=
{
callback
:
callback
,
then
:
then
,
delay
:
delay
,
...
...
@@ -40,7 +33,7 @@ d3.timer = function(callback, delay, then) {
d3_timer_interval
=
1
;
d3_timer_frame
(
d3_timer_step
);
}
}
}
;
function
d3_timer_step
()
{
var
elapsed
,
...
...
@@ -80,13 +73,14 @@ d3.timer.flush = function() {
d3_timer_flush
();
};
// Flush after callbacks
,
to avoid concurrent queue modification.
// Flush after callbacks to avoid concurrent queue modification.
function
d3_timer_flush
()
{
var
t0
=
null
,
t1
=
d3_timer_queue
,
then
=
Infinity
;
while
(
t1
)
{
if
(
t1
.
flush
)
{
delete
d3_timer_byId
[
t1
.
callback
.
id
];
t1
=
t0
?
t0
.
next
=
t1
.
next
:
d3_timer_queue
=
t1
.
next
;
}
else
{
then
=
Math
.
min
(
then
,
t1
.
then
+
t1
.
delay
);
...
...
src/core/transition-delay.js
View file @
044f6150
d3_transitionPrototype
.
delay
=
function
(
value
)
{
var
id
=
this
.
id
;
return
d3_selection_each
(
this
,
typeof
value
===
"
function
"
?
function
(
node
,
i
,
j
)
{
node
.
delay
=
value
.
call
(
node
=
node
.
node
,
node
.
__data__
,
i
,
j
)
|
0
;
}
:
(
value
=
value
|
0
,
function
(
node
)
{
node
.
delay
=
value
;
}));
?
function
(
node
,
i
,
j
)
{
node
.
__transition__
[
id
].
delay
=
value
.
call
(
node
,
node
.
__data__
,
i
,
j
)
|
0
;
}
:
(
value
|
=
0
,
function
(
node
)
{
node
.
__transition__
[
id
].
delay
=
value
;
}));