MCPcopy
hub / github.com/plotly/plotly.js / moveNode

Function moveNode

test/jasmine/tests/sankey_test.js:1584–1605  ·  view source on GitHub ↗
(sankey, graph, nodeIndex, delta)

Source from the content-addressed store, hash-verified

1582 }
1583
1584 function moveNode(sankey, graph, nodeIndex, delta) {
1585 var node = graph.nodes[nodeIndex];
1586 var pos0 = [node.x0, node.y0];
1587 var pos1 = [node.x1, node.y1];
1588
1589 // Update node's position
1590 node.x0 += delta[0];
1591 node.x1 += delta[0];
1592 node.y0 += delta[1];
1593 node.y1 += delta[1];
1594
1595 // Update links
1596 var updatedGraph = sankey.update(graph);
1597
1598 // Check node position
1599 expect(updatedGraph.nodes[nodeIndex].x0).toBeCloseTo(pos0[0] + delta[0], 0);
1600 expect(updatedGraph.nodes[nodeIndex].x1).toBeCloseTo(pos1[0] + delta[0], 0);
1601 expect(updatedGraph.nodes[nodeIndex].y0).toBeCloseTo(pos0[1] + delta[1], 0);
1602 expect(updatedGraph.nodes[nodeIndex].y1).toBeCloseTo(pos1[1] + delta[1], 0);
1603
1604 return updatedGraph;
1605 }
1606
1607 describe('d3-sankey', function() {
1608 function _calc(trace) {

Callers 1

sankey_test.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…