Welcome to yEd Q&A!
Here you can ask questions and receive answers from other members of the community and yEd developers. And you can tell us your most wanted feature requests.


Integrate graphml files with webpage

0 votes
Hi Team,

I am looking for solution to integrate graphml files with our python based webpage.

We are currently running our python scripts to generate the graphml files manually running on spyder. Is there a way I click a link on web gae and run script in background and open graphml files on yED to visualize.

Please help!!
in Help by

1 Answer

0 votes

yEd is a desktop application, it is neither a web application nor a server application. Thus yEd cannot be embedded into a webpage nor can it receive messages from a webpage.

The proper way to read GraphML files and show the corresponding graphs in a web application would be to use the commercial yFiles for HTML programming library.

Other than that, you could send the diagram to the web-based editor yEd Live, which supports two ways of directly loading external GraphML files (that explicitly prompts the user before loading the external file):

1) Provide a ?file=... parameter with an URL pointing to the content of a GraphML file. For example, https://www.yworks.com/yed-live/?file=https://gist.githubusercontent.com/fskpf/51cbd1d159a9fcca83a7df421ed54670/raw/cd944ccdb2c6a1f1348ad59b89e7e15b8566d589/organic1 which points to a Gist. The only requirement on that URL is that it must be cross-origin accessible.

2) Use the postMessage API to send the GraphML to the yEd Live window (though I'm not sure whether this can be triggered from your environment):
Once yEd Live is loaded and ready to accept a data message, it posts a message to the opener with 'yed-live-listening'.

After that, you can post a message to yEd Live with an object with {graphml: <string>, source: <string>}. The 'source' is just a hint that indicates from which application the diagram originates.

A simple TypeScript implementation of this would look like this: https://gist.github.com/fskpf/1568f491bc00f1ebfc0a93db310b6460

That said, we do not provide any guarantees about the external triggers of yEd Live. They may change (or be limited) at any time without further notice.

by [yWorks] (1.3k points)
Legal Disclosure | Privacy Policy