You can create Legends automatically by extracting them from model elements. When you create a Legend automatically, main Legend properties, such as Name and Legend Items, are specified for you. The property values of an automatically created Legend are extracted from the stereotype tags of the selected element. If you want to create and specify Legend Items by yourself, create Legends manually.

Extracting Legends

You can only extract Legends from the elements that have the stereotype tags with Enumeration type.



To create a Legend automatically


  1. Open the diagram or table in which you want to create a Legend.

  2. Right-click the shape or table row of the element from which you want to generate a Legend, and select Tools > Extract Legends.

    Alternative methods

    You can also access the Extract Legends command by right-clicking the actual element in the model browser. But in this case, you have to apply the Legend to desired diagrams by yourself.

  3. In the Select Tags dialog select the stereotype tag from which you want to generate a Legend. You can also select multiple tags to generate multiple legends at once.
  4. Click OK.


The Legend is automatically displayed and applied to the diagram. The name of the selected tag is used as the Legend name, and every possible tag value creates an individual Legend Item.


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:

  1. Open the Requirement Diagram in which you want to create the Legend identifying different Requirement risk values.
  2. Right-click the shape of any Requiremenn and select Tools > Extract Legends.
  3. In the Select Tags dialog select the risk tag of the «extendedRequirement», as highlighted in the figure below.
  4. Click OK.


The Risk Legend is automatically displayed and applied in the Requirements Diagram. The name of the 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.