Closed joostshao closed 8 years ago
I am not quite sure I am getting you, but are you asking how to convert the node coordinates such as given (e.g. @-1.879,-1.875) into screen coordinates?
If so, basically dagitty computes the bounding box of the screen coordinates, adds padding, and then maps that to the bounding box of the drawing window. Relevant code is in GraphLayouter.js (function layoutCalcBounds) and GraphGUI_View.js (function initializeCoordinateSystem).
The new dagitty syntax (based on GraphViz) also allows specifying the bounding box explicitly like so:
dag { graph [bb="0,0,100,100"]
x [pos="50,50"] y [pos="20,20"]
x -> y }
The example you're quoting still uses the old syntax, I had no time yet to convert them all over.
hi, although you didn't understand what i mean, but thank you !
first: convert node coordinates to the browser, it is already you implimented.
but what i ask is that(maybe some diffcult): how to generate the node coordinates from the matrix.
for example:
"0 1 1\n"+
"0 0 1\n"+
"1 1 0\n"+
how to get the coordinates(x, y values) from the 3 dimensions matrix?
the image showed is only 3 nodes, but if there have 20 nodes, how to make every node's coordinates rational to show a clean and streakiness images ?
I see. The problem you are describing is called "Graph Drawing" (https://en.wikipedia.org/wiki/Graph_drawing). This is indeed by no means an easy problem and hundreds of algorithms have been to solve it. There's also a dedicated software called "graphviz" for doing that. Dagitty only implements one graph drawing algorithm called "force directed" or "spring" (https://en.wikipedia.org/wiki/Force-directed_graph_drawing), see class GraphLayouter.js. This is what dagitty uses to automatically generate node coordinates.
I am closing this issue since it is not directly related to dagitty.
thank you , i get you meaning.
hi, i have a question about the node's position? Look the meta data like this below.
how to calculte the nodes's positions(x,y) as the Matrix like this? the important thing is to visuliazation.