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 @@
- + +