GetIndexByTime - method of the tvPoints object
Search for index of data point according to specified parameters.
Long GetIndexByTime(Variant vTime, Variant nStyle, Long nIndexType)
|vTime||(Variant) Time whereby the data point has to be searched
The time is expected according to setting the PmgTrendViewer.TimeSetType property, i.e. "local time", "standard time" or "daylight-saving time".
|nStyle||(Variant) Specifies the data point with respect to the vTime time|
0 - the point whose time is less or equal vTime
1 - the point whose time is greater or equal vTime
2 - the point that is the closest to the vTime time
| nIndexType||(Long) Required type of the returned index|
0 - Index refers to the beginning of the buffer
1 - Index refers to the first data point that is displayed by the buffer viewer
The method returns the index of the found point or -1 if no point has been found.
The index value that is returned by the method, depends on the nIndexType parameter and refers either to the whole buffer or only to the visible part of the buffer.
Let's have the buffer with 100 data points in total, 50 of them are displayed in the viewer and the index of the first displayed point is 7. Suppose that the method finds the first point that suits the vTime time according to nStyle and the index of this point is 10. Then on setting nIndexType to 0 the value on the index 10 is returned, on setting it to 1 the value on the index 3 is returned.
Time has to be entered as the "local time" (the "standard time" in the standard season and the "daylight-saving time" in the daylight-saving season.)
oTView = pMe;
oTView.TimeSetType = 1;
vTime = "..."; //is "local time"
vTime, 0, 0);
Time has to be entered as the "standard time" even in the daylight-saving season:
oTView.TimeSetType = 2;
vTime = "..."; //is "standard time"
vTime, 0, 0);