API Documentation -> NtDataObject

# NtDataObject

NtDataObject is one of the most important classes for Nateo API programmers: All data objects you want to store within the NtTimeChartControl must be derived from this class. Often you will have objects that you can not derive from this class (because they are already defined and derived from something else). In this case, simply create a new class type derived from Nateo.NtDataObject containing a reference to your object type. Instantiate one per data object and store that instance into the time chart control.
If you have a set of NtDataObjects you want to store in the NtTimeChartControl, you can call its SetData or InsertDataObjects member functions. If you only have one or very few NtDataObjects to add, you can also call InsertDataObject for each of them.
The NtTimeChartControl can hold millions of NtDataObjects depending on available memory.
The NtDataObject does not have any construtor. You rather create it and initialize its members. It also has no member methods.
Please see the tutorial Data Objects for deatils on how to use this class and how to store data in the Time Chart.

Class Hierarchy:

System.Object

NtDataObject

Members:

Type | Name | Description
--- | --- | ---
public ulong | objId | The objId is identifier of the NtDataObject. Within one NtTimeChartControl there must not exist two different NtDataObjects that have the same id. It is the obligation of the application to guarantee this because otherwise objects with duplicate ids can not be inserted to the Time Chart or will replace those that already exist.
public int | dataTypeId | The dataTypeId defines the type of data this object holds. The NtTimeChartControl assigns NtDataObjects to the different rows based on the dataTypeId: The Nateo.NtPerspective currently active in the NtTimeChartControl defines which data types are to be shown in which row (one row can be used for more than one data type). On this way all NtDataObjects of the same data type are displayed in the same row of the Time Chart. The dataTypeId also determines how a certain data type is being drawn (as a courve, texts, icons, custom drawn): The Nateo.NtDisplayDef (one for each data type) define the details on drawing a certain type of data.
public DateTime | dt | The time stamp of the data object. It is ok to use the full time range of the System.DateTime struct.
public DateTime | dtEnd | The time stamp of the end of the time span, if the object represents a time span. It depends on the way how the NtDataObject shall be drawn if this member is being used or not. It makes sense to define an end if your data is not an event (that takes place on one certain point of time) but has a length in time like if a car is being rented to a customer for several days.
public string | dataItem | NtDataObject is meant to be either a base class or a container for your specific data. This means that you have two options: You can either reference your own data objects by this member dataItem or you create a subclass of NtDataObject and enhance it by all data elements you need. In either case you will then add the NtDataObject instances to the Time Chart.

Remarks:

There are several things to keep track of when using NtDataObjects:

- Data type ids stored in the member dataTypeId must be greater than zero and less than 10000. Trying to add a NtDataObject with any other data type id will result in an ArgumentException.
- It is an error to change the objId of any NtDataObject that is currently stored in a NtTimeChartControl. If you do so, the behaviour of the Time Chart will be undefined.
- Whenever you change the time stamp or the end date or the value or the data type of an object you should call InsertDataObject() or InsertDataObjects() of the NtTimeChartControl for the affected data objects to update the Time Chart accordingly. Afterwards you should also call Invalidate() on the NtTimeChartControl to make the changes visible.

Examples:

This is an example on how to derive from NtDataObject to store a car renting procedure:

public struct Customer { string name, address, insuranceInfo; }
public class CarRentingDataObject : Nateo.NtDataObject
{
public string licencePlateNumber;
public Customer customer;
public CarRentingDataObject(long _objId, DateTime rentalDate, DateTime returnDate, string lpn, Customer c)
{
objId = _objId;
dataTypeId = 50; //choosen arbitrarily to identify this data type.
dt = rentalDate;
dtEnd = returnDate;
licencePlateNumber = lpn;
customer = c;
text = licencePlateNumber;
}
}

CarRentingDataObjects can then be stored in the NtTimeChartControl. And as the dataTypeId is 50, there also has to be a Nateo.NtDisplayDef with dataTypeId 50 stored in the NtTimeChartControl. This will control how CarRentingDataObjects are being displayed.

Top API Documentation -> NtDataObject © 2016 Bassaly