How to create a custom property and then connect it to a shape

945 views
Skip to first unread message

Jonas Norrby

unread,
Feb 22, 2022, 11:54:55 AM2/22/22
to diagrams.net Q&A
Hi,

I want to be able to controle the color of a part of my shape by checking a checkbox in the property field of the shape. My problem is that I cannot find a tutorial or webpage which explains how to do this.

So I'm either looking for a link to a tutorial or webpage explaining how to doe this or if possible an example file or explanation on how to doe this.

Regards in advance,

Jonas Norrby
ShapeQuestion.png
Shape.drawio

Francisco Balzarotti

unread,
Mar 12, 2022, 12:01:13 PM3/12/22
to diagrams.net Q&A
Hi,

I'm also looking for this.

What you're looking for would behave like the shape mxgraph.atlassian.issue: link.
It has properties that modify the appearance.

This is coded here:

I would like to hear from the development team whether it's possible to create our own shapes that have these kinds of behaviors.

Best,
Francisco

Martin Cleaver

unread,
Mar 20, 2022, 2:02:36 PM3/20/22
to diagrams.net Q&A
Same. I want to use a diagram to illustrate the current state of an external system. 
The external system state changes. I'd like the diagram to change in response.

So the state needs to be brought in, and expressed on the diagram.
  • It seems properties are the sole integration point. 
  • It seems that properties can control some things, but not others. For instance, it seems properties can determine the shape of something, but not the label text nor the color. 
  • It seems that properties get their initial value from the XML file but that the user can alter them in the page currently loaded into the browser.
  • It seems there is a synchronization action available to "update from external" - I don't see an inbound API that would allow a push  of the property change via API  
  • While one can inspect the XML or inspect an individual element for data, I don't see a data structure view that shows just the properties and their current values.
  • When building though the UI, it seems that properties should be retrofitted through the XML because the UI will validate and prevent save of changes containing properties.
    • This raises the question of evaluation order and scope.

It's okay that the page updates only on reload of the page, but I'd prefer API push or manual synchronization (pull).

For what I want to show, I could use the web version of diagrams.net or  the Jira or Confluence or Cloud versions. Whatever requires fewest workarounds.

If anyone can confirm or deny the points above or has suggestions how to implement - I'd much appreciate it.

Thanks,
   Martin.




Reply all
Reply to author
Forward
0 new messages