How to add a custom vertex image (Parallelogram) in mxGraph

256 views
Skip to first unread message

Jons Dogg

unread,
Sep 13, 2022, 10:49:30 AM9/13/22
to diagrams.net Q&A

I am creating a diagram creation tool for constructing flowchart using mxGraph, with the dynamictoolbar.html as a base template. So far, I have been able to add in the images of all the shapes in the toolbar and have it draggable across the graph. The shapes are as follows: EllipsesHexagonRectangle, and Diamond. The only issue I found is implementing the Parallelogram shape.

I tried this code so far:

addVertex('editors/images/parallelogram.gif', 40, 40, 'shape=parallelogram');

But to no avail


I then tried a different approach as so:

addVertex('editors/images/image.gif', 40, 40, 'image=my_image_url.jpg');

Also to no avail

I later found out after opening the diagrameditor.xml that mxGraph has no parallelogram shape. The closest shape was Rhombus, but the user has to rotate it and make it larger to make it look like a parallelogram, which is inadvisable.

Please someone suggest me how to accomplish this.

diagrams.net Q&A

unread,
Sep 13, 2022, 10:53:05 AM9/13/22
to diagrams.net Q&A
We killed off mxgraph a while back, all I could suggest is to use the drawio codebase, that has one.

Jons Dogg

unread,
Sep 13, 2022, 10:58:53 AM9/13/22
to diagrams.net Q&A
Sorry. I didn't realized that.

Can you direct me to a place where I can ask this question please?
Reply all
Reply to author
Forward
0 new messages