Support drawing graphs in the test/examples
directory
#298
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I know that elkjs does not officially support the drawing of graphs (just layout), but I wondered if you would like to add a simple script that allows us to see the graphs in the
test/examples
directory.I have found this very useful when working on ELK. My workflow is:
I've written
SimpleGraphDrawer.js
which draws ELK graphs given in JSON format as SVG.Furthermore, it handles all of the new JSON coordinate modes proposed in eclipse/elk#1071 .
This PR includes four files:
SimpleGraphDrawer.js
: The drawing class (and a supportingSvgDrawing
class).test-browser-draw.html
: Same as the existingtest-browser.html
, except that now we draw the graph.test-browser-draw2.html
: Liketest-browser-draw.html
but with a more interesting graph (namely, the one from here ).test-browser-draw-all-modes.html
: Draws a single graph 6 times, with all possible combinations of the new JSON coordinate modes.