Overview

This training material encompasses the basic SystemWeaver item charts generation feature of swExplorer. Examples and exercises are provided.

Course Type

Suitable for class training or for self study.

Course Length

Two hours to half-day course.

Prerequisites

  • Completed the Report Generation - Introductory Training.
  • Familiarity with SystemWeaver concepts such as Items, Parts and Attributes, and also with the GUI and common operations of the swExplorer.  
  • Knowledge of XML.
  • An installation of the SystemWeaver client (swExplorer).
  • A training server (If the course leader has not set up a server for the class, you can set up your own server by following the instructions in Setting up a Test Server).
  • An installation of the Script Language Training sqlite training database. See Database for Script Language Training.

Exercises

The answers to all exercises can be found in the swExplorer ribbon tab Report Training>Answers under Charts.



Note: This training does not cover GUI and view concepts.


Introduction

Charts in SystemWeaver are comprehensible and compact ways to present information about a particular element such as an attribute, part or property. They are visualized in color, include a legend and interact with the structure tree to allow you to easily trace back to view the items included in the chart. This course does not cover the complete functionality and available options. After completing this course, explore all available features by using the SystemWeaver Help accessed by clicking the ? in the swExplorer or by taking the next available course.


Types of Charts

There are three types of charts:

  • Pie chart (defined by the <PieChart> tag)
  • Area chart (defined by the <AreaChart> tag)
  • Column chart (defined by the <ColumnChart> tag)


      


Definition

Just like with tables and grids, you must first select an item in the structure tree to get started. Charts are defined in the Chart Editor found in the View drop-down menu by selecting Charts and Sandbox:

As with all configurable features, charts consist of one definition part and one data collection part.

Slices

  • <Slices>: This section describes the available chart slices.
  • <Slice>: This element defines a set of objects that can be visualized in a chart, e.g., labels and colors. 
    • The "name" attribute is used to assign Items to the <Slice>.
    • The ”caption” attribute sets the label for the slice in the chart.
    • The ”color” attribute sets the color of the <Slice>. Hex values can be used here to define non-standard colors. If no color is specified, a (unique) color will be selected automatically.


<Charts>

 <PieChart>

     <Slices>

         <Slice name="first" caption="one" color="blue"/>

         <Slice name="second" caption="two" color="red"/>

     </Slices>

     <Counter>

         <AddToSlice name="first"/>

         <AddToSlice name="second"/>

     </Counter>

 </PieChart>

</Charts>


Data

  • <Counter>: This section contains the data collection for the chart. A counter is an object that keeps track of sets, and be displayed as a chart. Pie charts only have a single counter, while Area charts have a counter for each separate series of the Area Chart.
  • <AddToSlice>: This section is used to add data (as defined in <Counter>) to the slices.
    • The ”name” attribute in <AddToSlice> indicates what slice to assign it to.


<Charts>

 <PieChart>

     <Slices>

         <Slice name="first" caption="one" color="blue"/>

         <Slice name="second" caption="two" color="red"/>

     </Slices>

     <Counter>

         <AddToSlice name="first"/>

         <AddToSlice name="second"/>

     </Counter>

 </PieChart>

</Charts>



<Charts>

 <AreaChart caption="My Area">

     <Slices>

         <Slice name="first" caption="one" color="blue"/>

         <Slice name="second" caption="two" color="red"/>

     </Slices>

     <Counter caption="first series">

         <AddToSlice name="first"/>

         <AddToSlice name="first"/>

         <AddToSlice name="second"/>

     </Counter>

     <Counter caption="second series">

         <AddToSlice name="first"/>

         <AddToSlice name="second"/>

         <AddToSlice name="second"/>

     </Counter>

 </AreaChart>

</Charts>



Note: Nothing is preventing an item from being included, i.e., counted, in multiple slices. For example, if your chart shows attributes, it's possible that one item may have more than one attribute.


Examples of Charts

A simple pie chart to illustrate the Definition example above:

<Charts>

 <PieChart>

     <Slices>

     <Slice name="first" caption="one" color="blue"/>

     <Slice name="second" caption="two" color="red"/>

     </Slices>

     <Counter>

     <AddToSlice name="first"/>

     <AddToSlice name="second"/>

     </Counter>

 </PieChart>

</Charts>


An example of a chart showing the Priority (PRIO) attribute for requirements. It utilizes <ForEachPart>, <ApplyItemTemplates>, and <Choose> elements which were covered in Report Generation - Introductory Training.

<Charts>
    <PieChart>
        <Slices>
            <Slice name="1" caption="Prio 1" color="blue"/>
            <Slice name="2" caption="Prio 2" color="red"/>
            <Slice name="3" caption="Prio 3" color="yellow"/>      
            <Slice name="unknown" caption="Unknown" color="green"/>
        </Slices>
        <Counter>
          <ForEachPart type="XESX">
            <DefObj>
                <ForEachPart type="EXAC">
                    <DefObj>
                        <ForEachPart type="IBAR">
                            <DefObj>
                                <ApplyItemTemplates/>
                             </DefObj>
                        </ForEachPart>
                    </DefObj>
                </ForEachPart>    
            </DefObj>
          </ForEachPart>
        </Counter>
    </PieChart>    
    <ItemTemplate type="RQ">
        <Choose>
            <When test="@PRIO = 1">
                <AddToSlice name="1"/>
            </When>
            <When test="@PRIO = 2">
                <AddToSlice name="2"/>
            </When>                
            <When test="@PRIO = 3">
                <AddToSlice name="3"/>
            </When>  
            <Otherwise>              
                <AddToSlice name="unknown"/>
            </Otherwise>        
        </Choose>  
    </ItemTemplate>
</Charts>


Tip: A quick way to create a new chart is to copy a similar one that is already defined as described in Report Generation - Introductory Training.

Bildresultat för exercise icon freeExercise 1 - Requirement Attribute Pie Chart

  1. Open Item: x0400000000000292.
  2. Open the Chart Editor.
  3. For the Vehicle Architecture, define a chart that divides the requirements according to their Verification Method attribute (ABVM).


Tip: This chart is very similar to the second example shown above.  Need help finding SIDs? See Finding SystemWeaver Type Identifiers (SIDs).


Expected result:


What's Next?

We hope that you are pleased with this course and are ready to generate charts. You can extend your knowledge of charts by practicing the numerous scripting options described in the SystemWeaver Script Language Reference section in the Help. Additional training in the SystemWeaver Script Language is available upon request.