Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support drawing graphs in the test/examples directory #298

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

skieffer
Copy link

@skieffer skieffer commented Sep 6, 2024

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:

  1. Make changes in ELK.
  2. Rebuild elkjs in a sibling directory.
  3. Reload a page from elkjs/test/examples in the browser.
  4. Repeat.

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/elk#1071 .

This PR includes four files:

  • SimpleGraphDrawer.js: The drawing class (and a supporting SvgDrawing class).
  • test-browser-draw.html: Same as the existing test-browser.html, except that now we draw the graph.
  • test-browser-draw2.html: Like test-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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant