L
- the concrete subclass of layoutT
- the type of datum in each nodeN
- the concrete subclass of nodepublic abstract class HierarchicalLayout<L,T,N extends HierarchicalLayout.Node<T>>
extends com.google.gwt.core.client.JavaScriptObject
You should use only concrete subclass of this one
Modifier and Type | Class and Description |
---|---|
static class |
HierarchicalLayout.Link<T>
A link between two nodes in a
HierarchicalLayout . |
static class |
HierarchicalLayout.Node<T>
A node used in a
HierarchicalLayout . |
Modifier | Constructor and Description |
---|---|
protected |
HierarchicalLayout() |
Modifier and Type | Method and Description |
---|---|
L |
children(DatumFunction<List<T>> df)
Sets the specified children accessor function.
|
Array<HierarchicalLayout.Link<T>> |
links(Array<N> n)
Given the specified array of nodes, such as those returned by nodes,
returns an array of objects representing the from parent to child for
each node.
|
Array<N> |
nodes(T data)
Runs the layout, returning the array of nodes associated with the
specified root node.
|
L |
sort(Comparator<N> comparator)
Sets the sort order of sibling nodes for the layout using the specified
comparator function.
|
L |
sort(com.google.gwt.core.client.JavaScriptObject sortFunction)
Sets the sort order of sibling nodes for the layout using the specified
comparator function.
|
protected com.google.gwt.core.client.JavaScriptObject |
toJSOComparator(Comparator<N> comparator)
internal trampoline method
|
DatumFunction<Integer> |
value()
Returns the current value accessor which defaults to null, meaning that
the value attribute is not computed.
|
L |
value(DatumFunction<Integer> df)
Sets the value accessor to the specified function.
|
public final Array<N> nodes(T data)
The input argument to layout is the root node of the hierarchy, and the output return value is an array representing the computed positions of all nodes. Several attributes are populated on each node:
HierarchicalLayout.Node
, or null for the root.
data
- the root node of the hierarchyHierarchicalLayout.Node
spublic final Array<HierarchicalLayout.Link<T>> links(Array<N> n)
Diagonal
shape
generator.the
- array of nodes, as returned by nodes(Object)
HierarchicalLayout.Link
connecting nodespublic final L children(DatumFunction<List<T>> df)
df
- a datum function describing how to compute childrenpublic final L value(DatumFunction<Integer> df)
For area-proportional layouts such as treemaps, this value is used to set the area of each node proportionally to the value; for other hierarchical layouts, the value has no effect on the layout.
df
- a datum function describing how to access node valuespublic final DatumFunction<Integer> value()
public final L sort(Comparator<N> comparator)
The comparator function is invoked for pairs of nodes, being passed the input data for each node. The default
comparator is null, which disables sorting and uses tree traversal order. Sorting by the node's name or key is
common and can be done easily via sort(JavaScriptObject)
using D3#ascending()
or
D3#descending()
.
comparator
- the comparator to use or null to remove the sortpublic final L sort(com.google.gwt.core.client.JavaScriptObject sortFunction)
The comparator function is invoked for pairs of nodes, being passed the input data for each node. The default
comparator is null, which disables sorting and uses tree traversal order. Sorting by the node's name or key is
common and can be done easily using D3#ascending()
or D3#descending()
.
From Java, you may prefer use sort(Comparator)
.
sortFunction
- the comparator to use or null to remove the sortprotected final com.google.gwt.core.client.JavaScriptObject toJSOComparator(Comparator<N> comparator)
comparator
- Copyright © 2017 gwt-d3. All rights reserved.