diff --git a/types/d3-hierarchy/d3-hierarchy-tests.ts b/types/d3-hierarchy/d3-hierarchy-tests.ts index 7e4181f822..16b372993d 100644 --- a/types/d3-hierarchy/d3-hierarchy-tests.ts +++ b/types/d3-hierarchy/d3-hierarchy-tests.ts @@ -104,17 +104,17 @@ idString = hierarchyRootNode.id; const ancestors: Array> = hierarchyRootNode.ancestors(); const descendants: Array> = hierarchyRootNode.descendants(); -// leaves() --------------------------------------------------------------- +// leaves() -------------------------------------------------------------- hierarchyNodeArray = hierarchyRootNode.leaves(); -// path() ------------------------------------------------------------------- +// path() ---------------------------------------------------------------- hierarchyNode = descendants[descendants.length - 1]; const path: Array> = hierarchyRootNode.path(hierarchyNode); -// links() and HierarchyLink<...> ------------------------------------------ +// links() and HierarchyLink<...> ---------------------------------------- let links: Array>; @@ -126,26 +126,26 @@ link = links[0]; hierarchyNode = link.source; hierarchyNode = link.target; -// sum() and value ---------------------------------------------------------- +// sum() and value ------------------------------------------------------- hierarchyRootNode = hierarchyRootNode.sum((d) => d.val); numOrUndefined = hierarchyRootNode.value; -// count() and value ---------------------------------------------------------- +// count() and value ----------------------------------------------------- hierarchyRootNode = hierarchyRootNode.count(); numOrUndefined = hierarchyRootNode.value; -// sort --------------------------------------------------------------------- +// sort ------------------------------------------------------------------ hierarchyRootNode = hierarchyRootNode.sort((a, b) => { console.log('Raw values in data of a and b:', a.data.val, ' and ', b.data.val); // a and b are of type HierarchyNode return b.height - a.height || b.value! - a.value!; }); -// each(), eachAfter(), eachBefore() ---------------------------------------- +// each(), eachAfter(), eachBefore() ------------------------------------- hierarchyRootNode = hierarchyRootNode.each((node) => { console.log('Raw value of node:', node.data.val); // node type is HierarchyNode @@ -162,7 +162,7 @@ hierarchyRootNode = hierarchyRootNode.eachBefore((node) => { console.log('Aggregated value of node:', node.value); // node type is HierarchyNode }); -// copy() -------------------------------------------------------------------- +// copy() ---------------------------------------------------------------- let copiedHierarchyNode: d3Hierarchy.HierarchyNode; copiedHierarchyNode = hierarchyRootNode.copy(); @@ -299,17 +299,17 @@ idString = clusterRootNode.id; const pointNodeAncestors: Array> = clusterRootNode.ancestors(); const pointNodeDescendants: Array> = clusterRootNode.descendants(); -// leaves() --------------------------------------------------------------- +// leaves() -------------------------------------------------------------- hierarchyPointNodeArray = clusterRootNode.leaves(); -// path() ------------------------------------------------------------------- +// path() ---------------------------------------------------------------- hierarchyPointNode = pointNodeDescendants[pointNodeDescendants.length - 1]; const clusterPath: Array> = clusterRootNode.path(hierarchyPointNode); -// links() and HierarchyPointLink<...> ------------------------------------------ +// links() and HierarchyPointLink<...> ----------------------------------- let pointLinks: Array>; @@ -321,19 +321,19 @@ pointLink = pointLinks[0]; hierarchyPointNode = pointLink.source; hierarchyPointNode = pointLink.target; -// sum() and value ---------------------------------------------------------- +// sum() and value ------------------------------------------------------- clusterRootNode = clusterRootNode.sum((d) => d.val); numOrUndefined = clusterRootNode.value; -// count() and value ---------------------------------------------------------- +// count() and value ----------------------------------------------------- clusterRootNode = clusterRootNode.count(); numOrUndefined = clusterRootNode.value; -// sort --------------------------------------------------------------------- +// sort ------------------------------------------------------------------ clusterRootNode = clusterRootNode.sort((a, b) => { console.log('x-coordinates of a:', a.x, ' and b:', b.x); // a and b are of type HierarchyPointNode @@ -341,7 +341,7 @@ clusterRootNode = clusterRootNode.sort((a, b) => { return b.height - a.height || b.value! - a.value!; }); -// each(), eachAfter(), eachBefore() ---------------------------------------- +// each(), eachAfter(), eachBefore() ------------------------------------- clusterRootNode = clusterRootNode.each((node) => { console.log('ParentId:', node.data.parentId); // node type is HierarchyPointNode @@ -358,7 +358,7 @@ clusterRootNode = clusterRootNode.eachBefore((node) => { console.log('X-coordinate of node:', node.x); // node type is HierarchyPointNode }); -// copy() -------------------------------------------------------------------- +// copy() ---------------------------------------------------------------- let copiedClusterNode: d3Hierarchy.HierarchyPointNode; copiedClusterNode = clusterRootNode.copy(); @@ -367,13 +367,13 @@ copiedClusterNode = clusterRootNode.copy(); // Tree // ----------------------------------------------------------------------- -// Create tree layout generator ======================================= +// Create tree layout generator ========================================== let treeLayout: d3Hierarchy.TreeLayout; treeLayout = d3Hierarchy.tree(); -// Configure tree layout generator ==================================== +// Configure tree layout generator ======================================= // size() ---------------------------------------------------------------- @@ -437,13 +437,13 @@ treemapLayout = treemapLayout.size([400, 200]); size = treemapLayout.size(); -// round() ------------------------------------------------------------ +// round() --------------------------------------------------------------- treemapLayout = treemapLayout.round(true); let roundFlag: boolean = treemapLayout.round(); -// padding() ---------------------------------------------------------------- +// padding() ------------------------------------------------------------- treemapLayout = treemapLayout.padding(1); treemapLayout = treemapLayout.padding((node) => { @@ -453,7 +453,7 @@ treemapLayout = treemapLayout.padding((node) => { numberRectangularNodeAccessor = treemapLayout.padding(); -// paddingInner() ---------------------------------------------------------------- +// paddingInner() -------------------------------------------------------- treemapLayout = treemapLayout.paddingInner(1); treemapLayout = treemapLayout.paddingInner((node) => { @@ -463,7 +463,7 @@ treemapLayout = treemapLayout.paddingInner((node) => { numberRectangularNodeAccessor = treemapLayout.paddingInner(); -// paddingOuter() ---------------------------------------------------------------- +// paddingOuter() -------------------------------------------------------- treemapLayout = treemapLayout.paddingOuter(1); treemapLayout = treemapLayout.paddingOuter((node) => { @@ -473,7 +473,7 @@ treemapLayout = treemapLayout.paddingOuter((node) => { numberRectangularNodeAccessor = treemapLayout.paddingOuter(); -// paddingTop() ---------------------------------------------------------------- +// paddingTop() ---------------------------------------------------------- treemapLayout = treemapLayout.paddingTop(1); treemapLayout = treemapLayout.paddingTop((node) => { @@ -483,7 +483,7 @@ treemapLayout = treemapLayout.paddingTop((node) => { numberRectangularNodeAccessor = treemapLayout.paddingTop(); -// paddingRight() ---------------------------------------------------------------- +// paddingRight() -------------------------------------------------------- treemapLayout = treemapLayout.paddingRight(1); treemapLayout = treemapLayout.paddingRight((node) => { @@ -493,7 +493,7 @@ treemapLayout = treemapLayout.paddingRight((node) => { numberRectangularNodeAccessor = treemapLayout.paddingRight(); -// paddingBottom() ---------------------------------------------------------------- +// paddingBottom() ------------------------------------------------------- treemapLayout = treemapLayout.paddingBottom(1); treemapLayout = treemapLayout.paddingBottom((node) => { @@ -503,7 +503,7 @@ treemapLayout = treemapLayout.paddingBottom((node) => { numberRectangularNodeAccessor = treemapLayout.paddingBottom(); -// paddingLeft() ---------------------------------------------------------------- +// paddingLeft() --------------------------------------------------------- treemapLayout = treemapLayout.paddingLeft(1); treemapLayout = treemapLayout.paddingLeft((node) => { @@ -543,7 +543,7 @@ tilingFactoryFn = d3Hierarchy.treemapResquarify.ratio(2); treemapLayout.tile(d3Hierarchy.treemapResquarify.ratio(2)); -// Use HierarchyRectangularNode ================================================ +// Use HierarchyRectangularNode ========================================== // x and y coordinates --------------------------------------------------- @@ -575,17 +575,17 @@ idString = treemapRootNode.id; const rectangularNodeAncestors: Array> = treemapRootNode.ancestors(); const rectangularNodeDescendants: Array> = treemapRootNode.descendants(); -// leaves() --------------------------------------------------------------- +// leaves() -------------------------------------------------------------- hierarchyRectangularNodeArray = treemapRootNode.leaves(); -// path() ------------------------------------------------------------------- +// path() ---------------------------------------------------------------- hierarchyRectangularNode = rectangularNodeDescendants[rectangularNodeDescendants.length - 1]; const treemapPath: Array> = treemapRootNode.path(hierarchyRectangularNode); -// links() and HierarchyRectangularLink<...> ------------------------------------------ +// links() and HierarchyRectangularLink<...> ----------------------------- let rectangularLinks: Array>; @@ -597,18 +597,18 @@ rectangularLink = rectangularLinks[0]; hierarchyRectangularNode = rectangularLink.source; hierarchyRectangularNode = rectangularLink.target; -// sum() and value ---------------------------------------------------------- +// sum() and value ------------------------------------------------------- treemapRootNode = treemapRootNode.sum((d) => d.val); numOrUndefined = treemapRootNode.value; -// count() and value ---------------------------------------------------------- +// count() and value ----------------------------------------------------- treemapRootNode = treemapRootNode.count(); numOrUndefined = treemapRootNode.value; -// sort --------------------------------------------------------------------- +// sort ------------------------------------------------------------------ treemapRootNode = treemapRootNode.sort((a, b) => { console.log('x0-coordinates of a:', a.x0, ' and b:', b.x0); // a and b are of type HierarchyRectangularNode @@ -616,7 +616,7 @@ treemapRootNode = treemapRootNode.sort((a, b) => { return b.height - a.height || b.value! - a.value!; }); -// each(), eachAfter(), eachBefore() ---------------------------------------- +// each(), eachAfter(), eachBefore() ------------------------------------- treemapRootNode = treemapRootNode.each((node) => { console.log('ParentId:', node.data.parentId); // node type is HierarchyRectangularNode @@ -633,7 +633,7 @@ treemapRootNode = treemapRootNode.eachBefore((node) => { console.log('X0-coordinate of node:', node.x0); // node type is HierarchyRectangularNode }); -// copy() -------------------------------------------------------------------- +// copy() ---------------------------------------------------------------- let copiedTreemapNode: d3Hierarchy.HierarchyRectangularNode; copiedTreemapNode = treemapRootNode.copy(); @@ -642,13 +642,13 @@ copiedTreemapNode = treemapRootNode.copy(); // Partition // ----------------------------------------------------------------------- -// Create partition layout generator ======================================= +// Create partition layout generator ===================================== let partitionLayout: d3Hierarchy.PartitionLayout; partitionLayout = d3Hierarchy.partition(); -// Configure partition layout generator ==================================== +// Configure partition layout generator ================================== // size() ---------------------------------------------------------------- @@ -656,19 +656,19 @@ partitionLayout = partitionLayout.size([400, 200]); size = partitionLayout.size(); -// round() ------------------------------------------------------------ +// round() --------------------------------------------------------------- partitionLayout = partitionLayout.round(true); roundFlag = partitionLayout.round(); -// padding() ---------------------------------------------------------------- +// padding() ------------------------------------------------------------- partitionLayout = partitionLayout.padding(1); num = partitionLayout.padding(); -// Use partition layout generator ========================================== +// Use partition layout generator ======================================== let partitionRootNode: d3Hierarchy.HierarchyRectangularNode; @@ -682,13 +682,13 @@ type CircularAccessor = (node: d3Hierarchy.HierarchyCircularNode; packLayout = d3Hierarchy.pack(); -// Configure pack layout generator ==================================== +// Configure pack layout generator ======================================= // size() ---------------------------------------------------------------- @@ -696,7 +696,7 @@ packLayout = packLayout.size([400, 400]); size = packLayout.size(); -// radius() ------------------------------------------------------------ +// radius() -------------------------------------------------------------- packLayout = packLayout.radius(null); @@ -708,7 +708,7 @@ packLayout = packLayout.radius((node) => { numberCircularNodeAccessorOrNull = packLayout.radius(); -// padding() ---------------------------------------------------------------- +// padding() ------------------------------------------------------------- packLayout = packLayout.padding(1); @@ -720,15 +720,15 @@ packLayout = packLayout.padding((node) => { numberCircularNodeAccessor = packLayout.padding(); -// Use partition layout generator ========================================== +// Use partition layout generator ======================================== let packRootNode: d3Hierarchy.HierarchyCircularNode; packRootNode = packLayout(stratifiedRootNode); -// Use HierarchyCircularNode ================================================ +// Use HierarchyCircularNode ============================================= -// x and y coordinates and radius r ------------------------------------------ +// x and y coordinates and radius r -------------------------------------- num = packRootNode.x; num = packRootNode.y; @@ -757,17 +757,17 @@ idString = packRootNode.id; const circularNodeAncestors: Array> = packRootNode.ancestors(); const circularNodeDescendants: Array> = packRootNode.descendants(); -// leaves() --------------------------------------------------------------- +// leaves() -------------------------------------------------------------- hierarchyCircularNodeArray = packRootNode.leaves(); -// path() ------------------------------------------------------------------- +// path() ---------------------------------------------------------------- hierarchyCircularNode = circularNodeDescendants[circularNodeDescendants.length - 1]; const packPath: Array> = packRootNode.path(hierarchyCircularNode); -// links() and HierarchyRectangularLink<...> ------------------------------------------ +// links() and HierarchyRectangularLink<...> ----------------------------- let circularLinks: Array>; @@ -779,19 +779,19 @@ circularLink = circularLinks[0]; hierarchyCircularNode = circularLink.source; hierarchyCircularNode = circularLink.target; -// sum() and value ---------------------------------------------------------- +// sum() and value ------------------------------------------------------- packRootNode = packRootNode.sum((d) => d.val); numOrUndefined = packRootNode.value; -// count() and value ---------------------------------------------------------- +// count() and value ----------------------------------------------------- packRootNode = packRootNode.count(); numOrUndefined = packRootNode.value; -// sort --------------------------------------------------------------------- +// sort ------------------------------------------------------------------ packRootNode = packRootNode.sort((a, b) => { console.log('radius of a:', a.r, ' and b:', b.r); // a and b are of type HierarchyCircularNode @@ -799,7 +799,7 @@ packRootNode = packRootNode.sort((a, b) => { return b.height - a.height || b.value! - a.value!; }); -// each(), eachAfter(), eachBefore() ---------------------------------------- +// each(), eachAfter(), eachBefore() ------------------------------------- packRootNode = packRootNode.each((node) => { console.log('ParentId:', node.data.parentId); // node type is HierarchyCircularNode @@ -816,7 +816,7 @@ packRootNode = packRootNode.eachBefore((node) => { console.log('Radius of node:', node.r); // node type is HierarchyCircularNode }); -// copy() -------------------------------------------------------------------- +// copy() ---------------------------------------------------------------- let copiedPackNode: d3Hierarchy.HierarchyCircularNode; copiedPackNode = packRootNode.copy(); diff --git a/types/d3-hierarchy/index.d.ts b/types/d3-hierarchy/index.d.ts index 31209377b9..0ec823cc78 100644 --- a/types/d3-hierarchy/index.d.ts +++ b/types/d3-hierarchy/index.d.ts @@ -576,7 +576,7 @@ export interface TreemapLayout { */ export function treemap(): TreemapLayout; -// Tiling functions ----------------------------------------------------------------------- +// Tiling functions ------------------------------------------------------ /** * Recursively partitions the specified nodes into an approximately-balanced binary tree,