You can create Legends automatically by extracting them from model elements. Additionally, you can automatically add new Legend items directly from the smart manipulator of the Legend already displayed on your diagram.
Extracting Legends
You can create a Legend with the selected Legend items automatically. Legends can be extracted either from stereotype tags or the elements displayed on the diagram.
To extract Legends automatically from the applied stereotype tags typed by Boolean or Enumeration
Do one of the following:
- in open diagram, right-click the element shape and select Tools > Extract Legends in the shortcut menu.
- in the Model Browser, right-click the actual element and select Tools > Extract Legends in the shortcut menu.
- in the open table, right-click the row representing the actual element and select > Extract Legends From Row Type.
- In the open Extract Legends dialog, select the Legend representing the stereotype tag to generate a Legend from.
- Open a diagram in which you want to create a Legend.
- In the diagram toolbar, click > Extract Legends.
- In the open Extract Legends dialog, select the Legends you want to create automatically.
- Click Extract.
Extracting Legend items
You can add the selected Legend items automatically from the smart manipulator of the Legend shape displayed on the diagram pane.
To extract the selected Legend items automatically
- Open a diagram in which you want to create a Legend.
- In the smart manipulator toolbar of the selected Legend shape, click Auto-create Legend items.
In the open Auto-create Legend Items dialog, select the specific Legend item(s) to extract.
- Click Extract.
The selected Legend items are automatically displayed in the Legend shape and diagram symbols are adorned accordingly.
When extracting Legends or Legend items, you can specify the following options:
- Select Create Adornments to automatically set a Fill Color for element shapes and Pen Color for paths.
- Select Connectors by Ports to automatically create Legends for Connectors depending on the selected Ports Legend(s) (Stereotypes of Port Types, Stereotypes of Ports, and/or Port Types).
by checking connector end port in the similar way as selected port legend does.
Legend extraction mechanism
Legends listed in the Extract Legends dialog are generated automatically according to the types of elements displayed as symbols on the diagram pane.
Legend | Legend items |
---|---|
Element Types | element types (metaclasses and stereotypes) displayed on a diagram. |
Stereotypes of Port Types | stereotypes of classifiers used as displayed port types in a diagram. |
Stereotypes of Part Types | stereotypes of classifiers used as displayed property types in a diagram |
Stereotypes of Ports | stereotypes of ports displayed in a diagram. |
Stereotypes of Parts | stereotypes of parts displayed in a diagram. |
Stereotypes of Connectors | stereotypes of connectors displayed in a diagram. |
Port Types | classifiers used as displayed port types in a diagram. |
Part Types | classifiers used as displayed property types in a diagram. |
Flowing Items of Connector | conveyed classifiers of item flows realized by displayed connectors in a diagram. |
Flowing Items of Activity Edge | conveyed classifiers of item flows realized by displayed activity edges in a diagram. |
Flowing Items of Association | conveyed classifiers of item flows realized by displayed associations in a diagram. |
Name of applied stereotype tag typed by enumeration | enumeration literals owned by the applied stereotype tag type. |
Name of applied stereotype tag typed by boolean | true and false values. |
Example
Let's say that you want to extract the Legend identifying different Risk property values of Requirements in your model. To do this, complete the following steps:
- Open the Requirement Diagram in which you want to create the Legend identifying different Requirement risk values.
- Right-click the shape of any Requirement and select Tools > Extract Legends OR in the diagram toolbar, click > Extract Legends.
- In the open dialog, select the Risk Legend, as shown in the figure below.
- Click OK.
The Risk Legend is automatically displayed and applied to the Requirements Diagram. The name of the element tag is used as the Legend name, and every possible Risk property value creates an individual Legend Item.
The process of creating the Legend identifying different Requirement risk values in a Requirement Diagram.
Sample model
The model used in the figures of this page is the Legends sample model that comes with SysML plugin. To open this model, do one of the following:
- Download legends.mdzip.
- Open the model from the <modeling tool installation directory>\samples\SysML directory.