NtApplication.NtGetDouble Method

Whenever data objects shall be displayed as a curve plot, the NtTimeChartControl needs to know the double value of each of the objects. So it will call this interface method to call your code. You will retreive the NtDataObject as a parameter. Your data is contained in the NtDataObject.dataItem member, so you can return the correct double value.

Overload List:

Modifier / Return Value Name and Parameters Description

double

NtGetDouble ( NtDataObject ntDo )

For the data object given as parameter you will return the correct double representation.

Return value:

double
The double value that represents the object.

Parameters:

NtDataObject ntDo
The data object that the Time Chart needs a value for.

Remarks:

The Time Chart guarantees to only call this interface mamber for those objects that are defined to be represented as crossmarked curves. For others that are to be drawn as strings, bitmaps or icons this method will never be called. This is important because you do not need to check the data type for these types. In other words, if all data objects that shall be drawn as crossmark curves are of the same type (e.g. double) you can omit the casting completely.

Example:

One smart and simple implementation looks like this:
 

public string NtGetDouble(NtDataObject ntDo)
{
double d;
if (double.TryParse(ntDo.dataItem.ToString(), out d)) return d;
return 0;
}


 
Now assume you added various data types to your Time Chart that all shall be drawn as text. The data types differ by their dataTypeId that you can use to differentiate. For example we have temperature values with dataTypeId 100 and MainBattery with dataTypeId 110:
 

public string NtGetDouble(NtDataObject ntDo)
{
if (ntDo.dataTypeId == 100) return (double)ntDo.dataItem;
if (ntDo.dataTypeId == 110) return ((MainBattery)ntDo.dataItem).chargePercent;
return 0;
}

See also:

NtGetBitmap()
NtGetIcon()
NtGetText()