From a516f7b3d6482c9b4f3c0345d9c640b2a88c10d3 Mon Sep 17 00:00:00 2001 From: TreetopFlyer Date: Thu, 20 May 2021 19:27:29 -0400 Subject: [PATCH] fixed modify out issue --- index.html | 27 ++++++++++++++++++++------- save.json | 20 ++++++++++++++++++++ 2 files changed, 40 insertions(+), 7 deletions(-) create mode 100644 save.json diff --git a/index.html b/index.html index b7ecf28..b90b398 100755 --- a/index.html +++ b/index.html @@ -27,7 +27,7 @@ var N = let check = N.Step(inNodeMajor, inKey, true); if(check) { - if(check.indexOf(inNodeMinor) < 0) + if(check.indexOf(inNodeMinor) !== -1) { return; } @@ -251,12 +251,12 @@ var Pivot = { // apply them to the branch inLastBranch.ID.Walk = N.ID.Walk; - modifiers.forEach( inModifier => N.Connect(inModifier, inLastBranch, "ModifyUp") ) + modifiers.forEach( inModifier => N.Connect(inModifier, inLastBranch, "ModifyOut") ) // also walk them up and connect, but with "check unique" enabled N.Walk( inNode=> { - modifiers.forEach( inModifier => N.Connect(inModifier, inNode, "ModifyUp", true) ) + modifiers.forEach( inModifier => N.Connect(inModifier, inNode, "ModifyOut", true) ) } , inLastBranch, "Hierarchy", false); } @@ -278,7 +278,13 @@ var Pivot = { N.ID.Walk++; - let pivotRoot = N.Create({Label:"Pivot Root", Leaves:Pivot.Leaves}); + let names = N.Step(Pivot.Schema, "label"); + let label = inPivotIndicies.map( inPivotIndex => + { + return names[inPivotIndex].Meta.Label; + }); + + let pivotRoot = N.Create({Label:label.join("|"), Leaves:Pivot.Leaves}); N.Connect(Pivot.Root, pivotRoot, "Pivot"); return Pivot.Pivot(pivotRoot, pivotRoot, inPivotIndicies, inSumIndicies); }, @@ -305,6 +311,8 @@ var Pivot = Modify(inNode) { let modified = N.Create({Label:"Modifier"}); + + // add the modifier to the appropriate root N.ID.Walk++; if(N.Step(inNode, "Hierarchy").length) { @@ -318,6 +326,7 @@ var Pivot = N.Connect(Pivot.Root, modified, "Modifier"); } + // traverse let leaves = []; let gatherUp = n => N.Connect(modified, n, "ModifyUp"); let gatherDown = n => @@ -325,7 +334,11 @@ var Pivot = N.Connect(modified, n, "ModifyDown"); N.Step(n, "Hierarchy").length == 0 ? leaves.push(n) : null; }; - let gatherOut = n => N.Connect(modified, n, "ModifyOut"); + let gatherOut = n => { + + N.Connect(modified, n, "ModifyOut"); + + }; N.ID.Walk++; inNode.ID.Walk = N.ID.Walk; @@ -425,7 +438,6 @@ let ElForm = props => action ]) }; - let ElNode = ({node, depth}) => { let nodeBase = css` @@ -509,7 +521,8 @@ let ElNode = ({node, depth}) => }; let ElPivot = ({pivot}) => { - return h("div", {style:{display:"inline-block", width:"800px"}}, [ + return h("div", {className:css`display:inline-block;`}, [ + h("h3", null, pivot.Meta.Label), h("button", {onClick:e=>{Pivot.Delete(pivot);Render();}}, "delete?"), h(ElModifiers, {node:pivot}), h(ElNode, {node:pivot, depth:0}) diff --git a/save.json b/save.json new file mode 100644 index 0000000..1849b6e --- /dev/null +++ b/save.json @@ -0,0 +1,20 @@ +[ + { + "name":"", + "csv":["data/output/1.csv", "data/output/2.csv"], + "pivots": + [ + { + "pivot":[0, 1], + "sum":[3], + "modifications": + [ + { + "path":[0, 0], + "modification":[0.2] + } + ] + } + ] + } +] \ No newline at end of file