You can associate custom values from any data type with diagram elements by setting their tag and id properties. Their values will be automatically serialized to JSON format using browser's JSON serializer when saving diagram JSON files. If saving XML files, you must handle the serializeTag and deserializeTag events to save non-string values in XML format. Apart from tag and id, JavaScript lets you create new object fields dynamically - these however will not be saved automatically in diagram files.
Builder objects with property setter methods and shortcut methods for fonts and brushes add support for fluent programming style. Static With and instance init methods in DiagramItem, Style and Layout -derived classes return a builder instance that can be used to set up respective new or existing objects:
JavaScript Copy Code |
---|
diagram.addItem( |