I have this JSON array
{"nodes":[
{"type":"simple-node","left":500,"id":"node-start","content":"Start"},
{"type":"simple-node","left":500,"id":"node-1","content":"Ironing"},
{"type":"simple-node","left":500,"id":"node-end""content":"End"}
],
"connections":[
{"start":"node-start","end":"node-1"},
{"start":"node-4","end":"node-5"}
]
}
I need to dynamically add "top" attribute to each element in nodes array so that it may look like this
{"nodes":[
{"type":"simple-node","left":500,"top":3403.252685546875,"id":"node-start","content":"Start"},
{"type":"simple-node","left":500,"top":3703.252685546875,"id":"node-1","content":"Ironing"},
{"type":"simple-node","left":500,"top":3903.252685546875,"id":"node-end""content":"End"}
],
"connections":[
{"start":"node-start","end":"node-1"},
{"start":"node-4","end":"node-5"}
]
topnumbers coming from? Are they random numbers? What have you tried? There's not enough info here to give a decent answer.