Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
MUR Drupal
d3-library
Commits
db8d3058
Commit
db8d3058
authored
May 19, 2014
by
Mike Bostock
Browse files
Merge branch 'fix-hierarchy-revalue'
parents
61c568f8
6b489696
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
34 additions
and
17 deletions
+34
-17
bower.json
bower.json
+1
-1
component.json
component.json
+1
-1
d3.js
d3.js
+11
-6
d3.min.js
d3.min.js
+2
-2
package.json
package.json
+1
-1
src/layout/hierarchy.js
src/layout/hierarchy.js
+10
-5
src/start.js
src/start.js
+1
-1
test/layout/hierarchy-test.js
test/layout/hierarchy-test.js
+7
-0
No files found.
bower.json
View file @
db8d3058
{
{
"name"
:
"d3"
,
"name"
:
"d3"
,
"version"
:
"3.4.
7
"
,
"version"
:
"3.4.
8
"
,
"main"
:
"d3.js"
,
"main"
:
"d3.js"
,
"scripts"
:
[
"scripts"
:
[
"d3.js"
"d3.js"
...
...
component.json
View file @
db8d3058
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
"animation"
,
"animation"
,
"canvas"
"canvas"
],
],
"version"
:
"3.4.
7
"
,
"version"
:
"3.4.
8
"
,
"main"
:
"d3.js"
,
"main"
:
"d3.js"
,
"scripts"
:
[
"scripts"
:
[
"d3.js"
"d3.js"
...
...
d3.js
View file @
db8d3058
!
function
()
{
!
function
()
{
var
d3
=
{
var
d3
=
{
version
:
"
3.4.
7
"
version
:
"
3.4.
8
"
};
};
if
(
!
Date
.
now
)
Date
.
now
=
function
()
{
if
(
!
Date
.
now
)
Date
.
now
=
function
()
{
return
+
new
Date
();
return
+
new
Date
();
...
@@ -6377,11 +6377,16 @@
...
@@ -6377,11 +6377,16 @@
return
hierarchy
;
return
hierarchy
;
};
};
hierarchy
.
revalue
=
function
(
root
)
{
hierarchy
.
revalue
=
function
(
root
)
{
if
(
value
)
d3_layout_hierarchyVisitAfter
(
root
,
function
(
node
)
{
if
(
value
)
{
d3_layout_hierarchyVisitBefore
(
root
,
function
(
node
)
{
if
(
node
.
children
)
node
.
value
=
0
;
});
d3_layout_hierarchyVisitAfter
(
root
,
function
(
node
)
{
var
parent
;
var
parent
;
node
.
value
=
node
.
children
?
0
:
+
value
.
call
(
hierarchy
,
node
,
node
.
depth
)
||
0
;
if
(
!
node
.
children
)
node
.
value
=
+
value
.
call
(
hierarchy
,
node
,
node
.
depth
)
||
0
;
if
(
parent
=
node
.
parent
)
parent
.
value
+=
node
.
value
;
if
(
parent
=
node
.
parent
)
parent
.
value
+=
node
.
value
;
});
});
}
return
root
;
return
root
;
};
};
return
hierarchy
;
return
hierarchy
;
...
...
d3.min.js
View file @
db8d3058
This source diff could not be displayed because it is too large. You can
view the blob
instead.
package.json
View file @
db8d3058
{
{
"name"
:
"d3"
,
"name"
:
"d3"
,
"version"
:
"3.4.
7
"
,
"version"
:
"3.4.
8
"
,
"description"
:
"A small, free JavaScript library for manipulating documents based on data."
,
"description"
:
"A small, free JavaScript library for manipulating documents based on data."
,
"keywords"
:
[
"keywords"
:
[
"dom"
,
"dom"
,
...
...
src/layout/hierarchy.js
View file @
db8d3058
...
@@ -60,11 +60,16 @@ d3.layout.hierarchy = function() {
...
@@ -60,11 +60,16 @@ d3.layout.hierarchy = function() {
// Re-evaluates the `value` property for the specified hierarchy.
// Re-evaluates the `value` property for the specified hierarchy.
hierarchy
.
revalue
=
function
(
root
)
{
hierarchy
.
revalue
=
function
(
root
)
{
if
(
value
)
d3_layout_hierarchyVisitAfter
(
root
,
function
(
node
)
{
if
(
value
)
{
d3_layout_hierarchyVisitBefore
(
root
,
function
(
node
)
{
if
(
node
.
children
)
node
.
value
=
0
;
});
d3_layout_hierarchyVisitAfter
(
root
,
function
(
node
)
{
var
parent
;
var
parent
;
node
.
value
=
node
.
children
?
0
:
+
value
.
call
(
hierarchy
,
node
,
node
.
depth
)
||
0
;
if
(
!
node
.
children
)
node
.
value
=
+
value
.
call
(
hierarchy
,
node
,
node
.
depth
)
||
0
;
if
(
parent
=
node
.
parent
)
parent
.
value
+=
node
.
value
;
if
(
parent
=
node
.
parent
)
parent
.
value
+=
node
.
value
;
});
});
}
return
root
;
return
root
;
};
};
...
...
src/start.js
View file @
db8d3058
!
function
(){
!
function
(){
var
d3
=
{
version
:
"
3.4.
7
"
};
// semver
var
d3
=
{
version
:
"
3.4.
8
"
};
// semver
test/layout/hierarchy-test.js
View file @
db8d3058
...
@@ -26,6 +26,13 @@ suite.addBatch({
...
@@ -26,6 +26,13 @@ suite.addBatch({
nodes
=
h
.
children
(
function
()
{
return
null
;
}).
nodes
({
children
:
[{}]});
nodes
=
h
.
children
(
function
()
{
return
null
;
}).
nodes
({
children
:
[{}]});
assert
.
equal
(
nodes
[
0
].
value
,
0
);
assert
.
equal
(
nodes
[
0
].
value
,
0
);
assert
.
isUndefined
(
nodes
[
0
].
children
);
assert
.
isUndefined
(
nodes
[
0
].
children
);
},
"
revalue
"
:
function
(
hierarchy
)
{
var
h
=
hierarchy
().
sticky
(
true
),
nodes
=
h
.
nodes
({
children
:
[{
children
:
[{
value
:
1
},
{
value
:
2
}]},
{
value
:
3
}]});
assert
.
equal
(
nodes
[
0
].
value
,
6
);
h
(
nodes
[
0
]);
// calls hierarchy.revalue
assert
.
equal
(
nodes
[
0
].
value
,
6
);
}
}
}
}
});
});
...
...
Write
Preview
Markdown
is supported
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