From 79cbbeb28754d2d0ba7c9d4b1e10b4ae83d40fa6 Mon Sep 17 00:00:00 2001 From: TreetopFlyer Date: Sat, 29 May 2021 11:33:14 -0400 Subject: [PATCH] new test block --- Pivot.js | 11 ++++------- index.html | 41 ++++++++++++++++++++++++++++++++++------- 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/Pivot.js b/Pivot.js index 27551b6..12d9e98 100644 --- a/Pivot.js +++ b/Pivot.js @@ -31,12 +31,8 @@ var Pivot = }, Pivot(inRoot, inParent, inPivotIndicies, inSumIndicies, inDepth) { - //arguments: - // - a Node with leaf Nodes temporarily stored in its Meta.Leaves - // - where each leaf Node has a row of table data in it's Meta.Row - // - a list of columns to pivot on - // - a list of columns to sum - // - optional traversal depth, defaults to 0 + + let depth = inDepth||0; let uniques = {}; let indexPivot = inPivotIndicies[depth]; @@ -44,6 +40,7 @@ var Pivot = { console.log("problem") } + // create a set of new nodes off of the input node inParent.Meta.Leaves.forEach((inLeaf)=> { let row = inLeaf.Meta.Row; // shorthand for the raw "CSV" row in the leaf Node's Meta @@ -78,7 +75,6 @@ var Pivot = match.Leaves.push(inLeaf); }); - // get the leaves out of the parent, at this point they have been re-distributed to the children delete inParent.Meta.Leaves; let iterator = () => {}; if(depth >= inPivotIndicies.length-1) @@ -136,6 +132,7 @@ var Pivot = Pivot.Pivot(inRoot, child, inPivotIndicies, inSumIndicies, depth+1); }; } + N.Walk(iterator, inParent, "Hierarchy"); return inParent; diff --git a/index.html b/index.html index 008aa83..b854be1 100755 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@
- + +