I want to add nodes to the specified positions. I started by adding two nodes to the same position (x = 0, y = 0):
$(document).ready(function() {
var cy = cytoscape({
container: document.getElementById('cy'),
});
cy.add([
{ group: "nodes", data: { id: "n0" }, position: { x: 0, y: 0 } },
{ group: "nodes", data: { id: "n1" }, position: { x: 0, y: 0 } },
]);
});
And I expected him to show me two nodes in the same position, one above the other. But the result was quite unexpected. Here is what I got:

In fact, the position of the nodes remains the same no matter what x and y values I specify. I also tried renderedPositioninstead position, but to no avail.
I am looking for Cytoscape documentation on how to achieve what I want, but have not yet been able to find a solution.
source
share