Compare commits

..

4 Commits

2 changed files with 40 additions and 7 deletions

View File

@ -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})

20
save.json Normal file
View File

@ -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]
}
]
}
]
}
]