Nateo Concepts -> Perspectives

# Nateo Concept: Perspectives

# Arranging data in rows

The Time Chart is organized in rows. And as explained in earlier chapters all data of one and the same type is shown in one and the same row. This does not necessarily mean that one row contains only one type of data. One row can contain more different data types. Suppose you have pressure data and temperature data. Then all temperature values are displayed in one row. It is not possible to show two different temperature values in two different rows. They will appear in the same row. And the same fits for the pressure values which all show up in a certain row. Anyway it is possible that temperature and pressure are shown in different rows or they might all be shown in the same row.

So how is it defined which data is arranged in which row? For example how is it defined that temperature shows up in the first row, while pressure is located in the second row?
The so called 'Perspective' is the answer to these questions. The Perspective defines which data is shown in which row. Basically the Perspective contains a list of so called 'Row Perspectives'. A Row Perspective is the data type assignment for a single row. In other words, the Row Perspective again contains a list of all data types that are located in that row.
The class type of the Perspective is NtPerspective and the class type of the Row Perspective is NtRowPerspective. The following figure shows a Perspective that sets up five rows. The first and the third row contain more than one sort of data.

In the following figure you can see the same data shown by two different Perspectives that differ in the order or Row Perspectives, only:

The next example shows how it might look like if two different data types are placed in the same row: In the left image you can see temperature and pressure shown in different rows, while in the right image both types of data are shown in the same row. Please note that the way how temperature and pressure are drawn does not change. The Perspective is only about row assignment.

## Row Heights

Obviously the height of the rows can be different among the rows within one Time Chart. This is also defined by the Perspective: Each of the NtRowPerspective within the perspective has a integer member rowHeight that determines the height of the row in pixels. When creating your Perspective and adding Row Perspectives to it, you can set their individual row heights.

## Defining Categories

Categories are groups of rows with one leading row (the so called Category Row). Typically your application will group rows into categories that contain similar types of data. For example in a medical application like a patient file you might have a category for lab values one for vital signs, one for medication and so on. For details on categories please see the chapter before: Concept Categories.
The definition of Categories is also done by the Perspective: Each of the NtRowPerspectives has an integer member named categoryLevel that defines if this row is a category row or a regular data row.
Example:
Suppose you want to organize your Time Chart in three layers: Main categories, subcategories and data rows. In the following image you can see an example like this: The main categories are 'Events' and 'Monitoring'. In 'Events' you find two subcategories 'Acute' and 'Regular' along with their data rows, while in 'Monitoring' you do not have subcategories but just data rows.

How does the Perspective look like in this case?
The NtPerspective has to contain one NtRowPerspective per row. Category rows count as rows here. So the first row is a main category. Its NtRowPerspective does not contain any dataTypeIds but its categoryText member will be 'Events'. As this is a top level row, its categoryLevel is 0.
The second row is a subcategory row. It does not contain any dataTypeIds but its categoryText is 'Acute'. Its category level is 1.
The third row is a data row. It contains the dataTypeId of the data type 'Vital Signs'. The categoryText is empty and the category level is 2.
Fourth and fith row are like the third, all having category level 2.
The sixth row has categoryText set to 'Regular' and categoryLevel is 1.
Row #11 again is a main category level. It has categoryText set to 'Monitoring' and categoryLevel is 0.
The following rows are interesting again: They are data rows and thereby again have categoryLevel set to 2 although their parent is a main category.
So there are some important facts to learn from this example:

1. High level categories have lower categoryLevel values (meaning that top most categories have 0).
2. All data rows have the same categoryLevel, which is one greater than the categoryLevel of the deepest subcategory.
3. It is not neccessary to have all sublevels in a main category. You can jump over certain levels and have deeper levels or data rows, only.
4. If you do not want categories at all but only data rows, then all data rows have categoryLevel 0.

A few words about the grouping: In the sequence from top to bottom row (first to last member in the Perspectiv's list of Row Perspectives) a superior category (lower categoryLevel) automatically groups all inferior subcategories. In the example above this means that the main category 'Events' has the categoryLevel 0 and thereby all subcategories and data rows that follow belong to it until 'Monitoring' wich also has categoryLevel 0.
In other words: A row of categoryLevel n owns all following rows as its members up until (but excluding) the next row of categoryLevel n.
So if you close a category of level n, all subsequent rows having a categoryLevel n+1 or higher will be hidden.

## Applying a Perspective to the Time Chart

Once you created and defined an object of type NtPerspetive you need to apply it to the NtTimeChartControl by calling SetNtPerspective(). You should have done this prior to the first drawing of the Time Chart. Later you can exchange the Perspective at any time by calling this function again. The view will change immediately.
When users change the order of rows or the order of categories or open and close categories, they automatically change the Perspective that currently is in use. In some cases you might want to save the current state of the display in order to reuse it later. Therefore you can call GetNtPerspective() to retrieve a clone of the currently active NtPerspective object. Later you can set this again to restore the view.

<< Prev.: Categories Next: Row Headers and Flank Controls >>

Top Concept Overview -> Perspectives © 2016 Bassaly