Implementing Zoom Schemas (Optional)

Zoom schemas enable you to define different visual schemas for organization charts.

Although schemas are designed to give the appearance of zooming in or out on the organization chart, in fact they are predefined views of the organization chart at different levels. Using schemas, you define what attributes to show on the node, and which nodes are displayed in each schema level. Users are able to select different views of the organization chart to see more or fewer nodes, and to see less or more data in the nodes.

You can define up to ten schema levels for an organization chart.

When zoom schemas are implemented for an organization chart, the chart displays a zoom control that enables a user to select a schema level.

The following example shows an organization chart with a zoom control and four schemas defined. The chart in this example displays schema level 3.

Example of an organization chart displaying schema level 3

The chart in the following example displays schema level 1, which displays less data on each node, allowing the chart to display more nodes in the same area.

Example of an organization chart displaying schema level 1

Each schema level defines the following attributes, based on the organization chart’s node display template:

  • Which icons are displayed.

  • Which descriptors are displayed.

  • The style of the node descriptor.

  • The position of the descriptors on the node.

    See “Using Node Display Templates” in Designing Organization Chart Nodes.

In addition, you can place FieldChange PeopleCode on the PTCHART_SCHEMA_ID field of the node record to control which nodes are displayed.

When the user changes schema levels, FieldChange PeopleCode on the PTCHART_SCHEMA_ID field of the node record executes. You can set the DISPLAYED_FLAG field on the node data rowset to control whether a node is displayed at the new schema level, or you can use PeopleCode to populate the organization chart node data rowset with only the nodes you want available at the new schema level.

Use the SchemaLevel object ImageHeight property to define whether the image (photo) is displayed in the node and the height of the image.

The size of the chart nodes is determined dynamically based on the subset of data within the node and the corresponding style properties for the schema level.

SchemaLevel Class

The SchemaLevel PeopleCode class provides methods and properties to set organization chart display information for each schema level.

SchemaLevel objects are declared using the SchemaLevel data type.

For example:

Local SchemaLevel &SchemaLevel1;
Component Chart &Abs_Hist_Chart;

Instantiate SchemaLevel objects using the CreateObject(“SchemaLevel”) PeopleCode function.

Implementing Schema Zooming

To implement schema zooming:

  1. Add PeopleCode to specify the initial schema level.

    Example:

    &oOrgChart.ChartCurrentSchemaLevel=4;
  2. Instantiate a SchemaLevel object for each schema level your chart will use.

    Example:

    SchemaLevel &oSchemaLevel1 = Createobject("SchemaLevel");
  3. Add PeopleCode to define each schema level.

    Example:

    /*** Create an instance of of schema zoom level 1 class and instantiate it ***/
    SchemaLevel &oSchemaLevel1 =Createobject("SchemaLevel");
    &oSchemaLevel1.ID=1;
    & oSchemaLevel1.ImageHeight=0;
    /*** Create an instance of of schema zoom level 2 class and instantiate it  ***/
    SchemaLevel &oSchemaLevel2 =Createobject("SchemaLevel");
    &oSchemaLevel2.ID=2;
    & oSchemaLevel2.ImageHeight=40;
    /*** Create an instance of of schema zoom level 3 class and instantiate it ***
    SchemaLevel &oSchemaLevel3 =Createobject("SchemaLevel");
    & oSchemaLevel3.ID=3;
    & oSchemaLevel3.ImageHeight=45;
    
    /*** Create an instance of of schema zoom level 4 class and instantiate it  ***/
    SchemaLevel &oSchemaLevel4 =Createobject("SchemaLevel");
    &oSchemaLevel4.ID=4;
    & oSchemaLevel4.ImageHeight=50;
    
  4. Assign the SchemaLevel instances to the OrgChart object.

    Example:

    /***   Assign the 4 schema level instance to the org chart object ***/
    &SchemaLevls=CreateArray(&oSchemaLevel1, &oSchemaLevel2, &oSchemaLevel3, 
    &oSchemaLevel4)
    &oOrgChart.SetZoomSchemaLevels(&SchemaLevls)
    
  5. Write FieldChange PeopleCode on the PTCHART_SCHEMA_ID field to execute when the user clicks on the schema zoom control to change the schema level.

    Example:

    Component Rowset &rs, &rsGrid;
    Component object &oOrgChart;
    rem WinMessage("value =" | &oOrgChart.ChartCurrentSchemaLevel);
    &currentZoom = &oOrgChart.ChartCurrentSchemaLevel;
       If &currentZoom = 1 Then      
          /* display all records and no image */
          For &i = 1 To &rsGrid.ActiveRowCount
             &RecGrid = &rsGrid.GetRow(&i).GetRecord(Record.QE_ORG_Z2_DRV);
             &RecGrid.GetField(Field.PTDESCR_UNDER_IMG).value = 0;         
             /* show all records */
             &RecGrid.GetField(Field.DISPLAYED_FLAG).value = "Y"
          End-For;      
       Else      
          If &currentZoom = 2 Then
             &limit = 6;
          Else
             If &currentZoom = 3 Then
                &limit = 4;
             Else
                &limit = 3;
             End-If;
          End-If;      
          For &i = 1 To &rsGrid.ActiveRowCount
             &RecGrid = &rsGrid.GetRow(&i).GetRecord(Record.QE_ORG_Z2_DRV);
             &RecGrid.GetField(Field.PTDESCR_UNDER_IMG).value = 3;
             If &RecGrid.GetField(Field.QE_ORG_SCHEMA_ROW).value < &limit Then
                &RecGrid.GetField(Field.DISPLAYED_FLAG).value = "Y";
             Else
                &RecGrid.GetField(Field.DISPLAYED_FLAG).value = "N";
             End-If;      
          End-For;      
       End-If;
    

Schema Events

When a user selects a different schema level using the zoom control, the following events take place:

  • The system sets the value in the CurrentSchemaLevel property to the new schema value.

  • The systems sets the value in the PTCHART_SCHEMA_ID to the new schema value.

  • FieldChange PeopleCode on the PTCHART_SCHEMA_ID field executes.

  • The system displays the organization chart at the new schema level.

You can also set the CurrentSchemaLevel property using PeopleCode.