d3.layout.hierarchical advertised .links() and .nodes() APIs in the documentation, but doesn't have it in the code. #803

Closed
wants to merge 110 commits into
from

Projects

None yet

9 participants

@GerHobbelt
Contributor

See API docs: https://github.com/mbostock/d3/wiki/Hierarchy-Layout#wiki-nodes

All hierarchical layouts have these, except d3.layout.hierarchy itself. Ran into this when changing some basic .links() code from using d3.layout.tree() to d3.layout.hierarchy() after reading the API docs.

@GerHobbelt
Owner

As these are the flattened files, you might be interested in commit @16c8cb3 which applies your tweak to the source files.

GerHobbelt and others added some commits Mar 3, 2012
@GerHobbelt GerHobbelt Merge remote-tracking branch 'remotes/mbostock/master'
Conflicts:
	d3.v2.min.js
	examples/zoom-pan/zoom-pan-transform.html
	examples/zoom-pan/zoom-pan.html
	package.json
facf889
@GerHobbelt GerHobbelt regenerated d3.v2.js and d3.latest.js + include pacakge.json from 2.8…
….1 (merge fix)
3684733
@GerardHundman GerardHundman Merge branch 'mbostock' fc5af31
@GerardHundman GerardHundman Merge remote-tracking branch 'remotes/mbostock/master' 50ee327
@jasondavies jasondavies Fix d3.svg.brush for IE9.
The problem with the old fix was the use of g.select(".background")
instead of g.selectAll(".background").  This caused the background rect
to get the parent's datum, overriding the initial datum of 0.  The brush
mouse handler checks the datum of the event target: a truthy datum means
a resize action.

We didn't see this problem in the brush examples because the brush
parent elements didn't use data binding.

I've also reverted to using pointer-events: none|null for the fix as this seems
more appropriate than display: none|null.
4642bc1
@GerHobbelt GerHobbelt Merge remote-tracking branch 'remotes/jasondavies/master'
Conflicts:
	d3.v2.min.js
	package.json
46131b6
@GerHobbelt GerHobbelt Merge remote-tracking branch 'remotes/jasondavies/brush-ie9'
Conflicts:
	d3.v2.min.js
65fb900
@GerardHundman GerardHundman Merge remote-tracking branch 'remotes/mbostock/master' c28a6f3
@GerHobbelt @GerardHundman GerHobbelt making force.start() just a wee bit more readable. d75dbea
@GerHobbelt GerHobbelt Merge remote-tracking branch 'remotes/mbostock/master'
Conflicts:
	d3.v2.min.js
203a177
@GerHobbelt GerHobbelt Merge remote-tracking branch 'remotes/jasondavies/master'
Conflicts:
	d3.v2.min.js
7aee34a
@GerHobbelt GerHobbelt Merge remote-tracking branch 'remotes/jasondavies/master'
Conflicts:
	d3.v2.min.js
9453500
@GerHobbelt GerHobbelt prevent crash in convex hull code for nasty point sets e438a71
@GerHobbelt GerHobbelt force cluster example: fixed minor hull error ('hulls' --> 'hullset')…
… + augmented example, showing distance function based on collected node/group info + click on node to expand/collapse (toggle) instead of harder-to-perform dblclick.
59f94b1
@GerHobbelt GerHobbelt force cluster example: fixed minor hull error ('hulls' --> 'hullset')…
… + augmented example, showing distance function based on collected node/group info + click on node to expand/collapse (toggle) instead of harder-to-perform dblclick.
e11e52a
@GerHobbelt GerHobbelt d3_time_century() would always return '2000' (unless you go way out o…
…f your way and then you'ld get 1000 or 3000, never 1900, because it divides by 1000, instead of 100. Never mind. It's only used internally, and there it's only to help 2-digit years become 4-digit years. Fix: convert to 4-digit year according to POSIX/ISO rules (strptime) ~ http://docs.python.org/py3k/library/time.html
a3940a7
@GerHobbelt GerHobbelt Merge remote-tracking branch 'remotes/jasondavies/master' dc38506
@GerHobbelt GerHobbelt Merge branch 'mbostock' 73c7f98
@GerHobbelt GerHobbelt Merge remote-tracking branch 'remotes/jasondavies/date-2d'
Conflicts:
	d3.v2.min.js
	src/time/format.js
14131c8
@GerHobbelt GerHobbelt discarding merged in minified version again 9af999d
@GerHobbelt GerHobbelt Merge remote-tracking branch 'remotes/mbostock/fix-time-full-year'
Conflicts:
	d3.v2.js
	d3.v2.min.js
	src/time/format.js
68be375
@GerHobbelt GerHobbelt Merge remote-tracking branch 'remotes/jasondavies/fix-time-dayOfYear'
Conflicts:
	d3.v2.min.js
027a9c3
@GerHobbelt GerHobbelt Merge remote-tracking branch 'remotes/jasondavies/fix-classed-remove'
Conflicts:
	d3.v2.min.js
0edfa37
@GerHobbelt GerHobbelt Merge remote-tracking branch 'remotes/jasondavies/dbltap'
Conflicts:
	d3.v2.min.js
d075ceb
@GerHobbelt GerHobbelt Merge remote-tracking branch 'remotes/mbostock/linear-closed-interpol…
…ation'

Conflicts:
	d3.v2.min.js
9d20497
@GerHobbelt GerHobbelt Merge remote-tracking branch 'remotes/jasondavies/master'
Conflicts:
	d3.v2.js
	d3.v2.min.js
cbb703b
@GerHobbelt GerHobbelt adjusted the Makefile to also work in settings where node or the ugli…
…fy/beautify/vows tools are not available.
348fa83
@GerHobbelt GerHobbelt cherry-picked @Polychart's Commit:f595c868ca21b3bab43162b82b41ac2bac1…
…00d73: 'Added Lisa's change.' --> cope with CSV input where one or more data rows have fewer columns than there are header columns (some CSVs with NULL columns at the end of each row can do that to you).
a7dd1ea
@snoble snoble change from HermiteSplines to CubicPolynomialSplines for monotonic 74dfdcf
@vogievetsky vogievetsky added code to d3.mouse to detect then WebKit is giving a bad CTM beca…
…use of zoom. Hopefuly 'fixing' this issue.
0248242
@GerHobbelt GerHobbelt Merge remote-tracking branch 'remotes/mbostock/2.10.0'
Conflicts:
	Makefile
	d3.v2.js
	d3.v2.min.js
	src/csv/parse.js
	src/time/format.js
a0aacdf
@GerHobbelt GerHobbelt fix for merge conflict: keep the code which tolerates NULL fields in …
…CSV (now DSV) inputs
b776272
@GerHobbelt GerHobbelt Merge remote-tracking branch 'remotes/jasondavies/master'
Conflicts:
	d3.v2.js
	d3.v2.min.js
13b16f8
@GerHobbelt GerHobbelt Makefile fix taken from the bleeding_edge -- now makefiles are in syn…
…c again
b3b38a6
@ZJONSSON ZJONSSON Adding y1 to default stackOut
SVG Rectangles start at top-left corner (x0,y1).  Providing y1
simplifies rendering and should be backwards compatable.
e07091b
@ZJONSSON ZJONSSON enter() and exit() point to an empty selection by default, not undefi…
…ned. This allows for better consistancy among selection objects, with enter() exit() chains ignored if no new data has been defined for the selection.
e07539f
@GerHobbelt GerHobbelt Merge remote-tracking branch 'remotes/mbostock/drag-multitouch'
Conflicts:
	d3.v2.js
	d3.v2.min.js
b1c22ef
@GerHobbelt GerHobbelt add wiki as documentation submodule (also handy when being off-net) 2d774c7
@GerHobbelt GerHobbelt Merge remote-tracking branch 'remotes/zjohnsson/default-enter-exit' 148ac2b
@GerHobbelt GerHobbelt Merge remote-tracking branch 'remotes/zjohnsson/stack-y1' bf80d3e
@GerHobbelt GerHobbelt add configurable subtick size for the subtick at .5, so we can create…
… classical axes. (By default, 'half' will have the same ticksize as any other subtick.)
61c9815
@GerHobbelt GerHobbelt Merge remote-tracking branch 'remotes/mbostock/fix-ordinal-single-point'
Conflicts:
	d3.v2.js
	d3.v2.min.js
94931cb
@GerHobbelt GerHobbelt Merge remote-tracking branch 'remotes/snoble/master': monotone spline…
…s fix

Conflicts:
	d3.v2.js
	d3.v2.min.js
59886b1
@GerHobbelt GerHobbelt further work on classical axis plotting support: minor, major and end…
…-tick sizes can be functions.
2c9b525
@GerHobbelt GerHobbelt improve log scale tick text formatting by adjusting .tickFormat() to …
…produce the half-way tick text whenever possible ([1,2,5,10] is better than [1,2,3,10]) and by adding the 'E' format type, which will print numbers close to zero (>= 0.001 and <= 900,000) in the regular (toPrecision) form, while smaller and larger numbers will still be printed in scientific notation (e.g. '1e-6')
2f6b638
@GerHobbelt GerHobbelt further work on the axis component: corrections and tweaks for the ti…
…ck subdivision logic and introduction of tick filter API method, so callers can filter the [sub]tick collections using custom handlers.
c54ee21
@GerHobbelt GerHobbelt whitespace policing e9c53fb
@GerHobbelt GerHobbelt further work on the axis component: see examples/axis/axis-classical.…
…html; added .ticks() methods to the quantile/quantize/threshold scales so those can be used for axes as well (scale.threshold is buggy)
8624917
@GerHobbelt GerHobbelt corrected the axis ticks and subticks .data key functions 4ab16a4
@GerHobbelt GerHobbelt removed dead code 816b2ba
@GerHobbelt GerHobbelt axis: custom orient = callback 60edfea
@GerHobbelt GerHobbelt fix the d3.axis.threshold.ticks() 41e4b6f
@GerHobbelt GerHobbelt d3.axis can now also be used outside a d3.selection.call(): when no s…
…election is passed in, the axis will produce an object with the ticks, subticks and all functors and parameters needed to create your own custom rendering of the given axis.
653cb9b
@GerHobbelt GerHobbelt whitespace policing 6d55a28
@GerHobbelt GerHobbelt examples/axis-classical.html now includes axes which use .tickSubdivi…
…de(false) and .tickSubdivide(true) and a string instead of number ( .tickSubdivide("9")) as these scenarios have to succeed by design (Mike Bostock)
a0d9fc7
@GerHobbelt GerHobbelt d3.layout.force: export the force.drag instance so users can modify i…
…t: calling dorce.drag() with no arguments returns the drag instance. Also fix the drag bahviour for when users add their own bits to the node.fixed attribute value: only clear the single relevant bit on drag end / mouse out.
9324b91
@GerHobbelt GerHobbelt removed the custom orient callback; custom axis work should be done u…
…sing the data returned by the axis-custom-radial.html() component instead.
9efa588
@GerHobbelt GerHobbelt d3.layout.force: both friction and charge are per-node functors. b00f281
@GerHobbelt GerHobbelt Merge remote-tracking branch 'remotes/jasondavies/xhr-accept'
Conflicts:
	d3.v2.js
	d3.v2.min.js
	src/layout/force.js
f8abf51
@GerHobbelt GerHobbelt d3.layout.hierarchical advertised .links() and .nodes() APIs in the d…
…ocumentation, but doesn't have it in the code.
3b78cbd
@GerHobbelt GerHobbelt d3.layout.hierarchical advertised .links() and .nodes() APIs in the d…
…ocumentation, but doesn't have it in the code.
5c3a23e
@GerHobbelt GerHobbelt Merge remote-tracking branch 'remotes/vogievetsky/master': fixes d3#766
Conflicts:
	d3.v2.js
	d3.v2.min.js
	src/core/mouse.js
e3d752c
@GerHobbelt GerHobbelt fix hierarchy.links inheritance: do NOT use the bind helper as that o…
…ne assumes the bound method will return the layout object when arguments are passed; .links(nodes) should return an array of LINKS instead, so a direct bind reference should be used instead.
1353d24
@GerHobbelt GerHobbelt tweak cluster-radial example to give root node special treatment: the…
…re out-angle is in-angle of the target node. This prevents odd-looking curved link lines as all targets would have the same out-angle for their links from root (ugly).
9d0dc95
@GerHobbelt GerHobbelt fix hierarchy.links inheritance: do NOT use the bind helper as that o…
…ne assumes the bound method will return the layout object when arguments are passed; .links(nodes) should return an array of LINKS instead, so a direct bind reference should be used instead.
00bfe7a
@GerHobbelt GerHobbelt quadtree: also store parent reference in each node so we can traverse…
… the tree in force layouts and elsewhere where only the relevant quadtree *node* is passed to us: we'd want to traverse starting at that node then anyhow.
9d1f862
@GerHobbelt GerHobbelt basic work on force layout: theta is now functor to allow optimized f…
…orce layout calculations based on potential or force rather than just distance.
d4c2ca7
@GerHobbelt GerHobbelt theta check should NOT be influenced by the alpha value (which slowly…
… decreases to zero); the check should identify items which are *relatively* important, while alpha reduces forces across the board.
d1c111b
@GerHobbelt GerHobbelt Revert "quadtree: also store parent reference in each node so we can …
…traverse the tree in force layouts and elsewhere where only the relevant quadtree *node* is passed to us: we'd want to traverse starting at that node then anyhow." --> having a 'parent' backreference would make the nodes in the tree have circular references, which is abad thing to have for less than truely smart garbage collectors.

This reverts commit 9d1f862.
0bd2ff2
@GerHobbelt GerHobbelt d3.behaviour.drag: dragstart and dragend events now also produce the …
…x/y/dx/dy event attributes (useful for those drags where you're only interested in the start and end, for example)
8010f15
@jasondavies jasondavies Reset zoom drift vector for new translate/scale.
If a new translate vector or scale is set, the internal drift vector for
zooming should be reset appropriately.
1005d61
@jasondavies jasondavies Fix typo. 67475de
@ZJONSSON ZJONSSON dsv.parse asynchronous when no arguments e1c356c
@mbostock mbostock Rewrite population example to be easier to follow. 44e4620
@GerHobbelt GerHobbelt Merge tag 'v2.10.2'
Release 2.10.2.

Conflicts:
	Makefile
	d3.v2.js
	d3.v2.min.js
927e26b
@GerHobbelt GerHobbelt Merge tag 'v2.10.3'
Release 2.10.3.

Conflicts:
	d3.v2.js
	d3.v2.min.js
fe5f174
@GerHobbelt GerHobbelt Merge remote-tracking branch 'remotes/jasondavies/master' 718cc9f
@GerHobbelt GerHobbelt Merge remote-tracking branch 'remotes/mbostock/3.0' into 3.0-dev
Conflicts:
	Makefile
	d3.js
	d3.v2.min.js
	examples/zoom-pan/zoom-pan-transform.html
	examples/zoom-pan/zoom-pan.html
	src/svg/axis.js
d52d9f6
@GerHobbelt GerHobbelt Merge remote-tracking branch 'remotes/zjohnsson/xhr2-async_dsv'
Conflicts:
	src/dsv/dsv.js
c7aed11
@GerHobbelt GerHobbelt Merge remote-tracking branch 'remotes/jasondavies/zoom-drift'
Conflicts:
	d3.v2.js
	d3.v2.min.js
841d80c
@GerHobbelt GerHobbelt Merge remote-tracking branch 'remotes/mbostock/3.0' into 3.0-dev
Conflicts:
	d3.js
	d3.min.js
082280b
@GerHobbelt GerHobbelt initial (non-working) code for arbitrary math/formula based scale: a …
…rip of the linear scale.
0dc5a8f
@GerHobbelt GerHobbelt minor timer comment doc update (to help me read the code easier/faster) 9ca7762
@GerHobbelt GerHobbelt regenerated d3 files f0c4076
@jasondavies jasondavies Fix d3.behavior.drag for Android.
It turns out that Android's changedTouches can have identifiers of 0.
223c456
@jasondavies jasondavies Fix typo. bf67747
@GerHobbelt GerHobbelt Merge remote-tracking branch 'remotes/jasondavies/3.0' into 3.0-dev: …
…WARNING: NULL-field handling in DSV (CSV/TSV) import may be broken with this merge!

Conflicts:
	Makefile
	d3.js
	d3.min.js
	examples/cartogram/demers.js
	examples/cartogram/dorling.js
	examples/cluster/cluster-radial.js
	examples/force/force-cluster.html
	examples/population/population.css
	examples/population/population.js
	examples/zoom-pan/zoom-pan-transform.html
	examples/zoom-pan/zoom-pan.html
	src/behavior/zoom.js
	src/dsv/dsv.js
	src/layout/force.js
	src/svg/axis.js
	src/time/format.js
5af861d
@GerHobbelt GerHobbelt updated the makefile to support machines which don't have NodeJS inst…
…alled.
b51991d
@GerHobbelt GerHobbelt wiki submodules updated eb2990c
@GerHobbelt GerHobbelt updated submodules a9d391c
@GerHobbelt GerHobbelt tweaked the npm/nodejs package.json file to use latest vows, etc. f88295b
@GerHobbelt GerHobbelt updated gitignore 37b15ba
@GerHobbelt GerHobbelt Merge remote-tracking branch 'remotes/jasondavies/3.0' into 3.0-dev
Conflicts:
	d3.js
	d3.min.js
f975d86
@GerHobbelt GerHobbelt Merge remote-tracking branch 'remotes/jasondavies/3.0' into 3.0-dev
Conflicts:
	d3.js
	d3.min.js
7092c82
@GerHobbelt GerHobbelt - update Makefile and provided en_us locale sources for those environ…
…ments which don't have a fully operational NodeJS rig.

- copared the D3.js with the one produced by vanilla 3.0-dev and corrected some glaring merge bugs that have creeped in over time.
12e976c
@GerHobbelt GerHobbelt Merge branch '3.0-dev' f80f15e
@GerHobbelt GerHobbelt Merge remote-tracking branch 'remotes/jasondavies/drag-android': touc…
…hID for Android can be zero(0), hence comparisons must be explicitly against 'null'

Conflicts:
	d3.js
	d3.min.js
	src/behavior/drag.js
3696507
@GerHobbelt GerHobbelt Merge branch 'master' into hierarchical_layout_links_nodes_API
Conflicts:
	src/layout/hierarchy.js
1e25497
@mbostock
Member

Thanks for the pull request and sorry for taking so long to respond. I see this one has picked up quite a few merges. :)

d3.layout.hierarchy is abstract and isn’t intended to be used directly, which is why the nodes method is not exposed; it doesn’t define a layout. It might be possible to expose the links method, but since the layout is not intended to be used directly there is no compelling reason to do so.

@mbostock mbostock closed this Jan 23, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment