"curveDataAtOffset","curveDataAtOffsetX"
Returns the data available for a specific curve at a specific time with an additional offset on the value index.
Synopsis
trendObj.curveDataAtOffset(string curve, time ti, int offset, mapping
&data);
getValue(trendObj, "curveDataAtOffset", string curve, time ti, int offset,
mapping &data);
Parameter
Parameter | Description |
---|---|
trendObj | Trend for which the attributed should be get |
curve | Name of the curve |
ti | Point in time for which the data should be returned |
offset | Offset for the value index. |
data | Data that is returned |
Details
The Function returns the data for a specific point of time for the given curve, including an offset for the value index. Inside of the trend, the values are stored within an array. Using the offset, previous or following values to a specific time inside of the trend can be queried. When using an offset of 0, the function behaves identical to the function "curveDataAt".
The offset can be a positive or negative value, where a positive value is a newer value from the time perspective. If there is no value for the offset within the array, an empty mapping is returned.
The returned data is a mapping that contains following information/keys:
- time - Exact time (might differ from the stated time)
- status - The status of the curve as bit64
- value - the corresponding average value as float
- minValue - the corresponding minimum value as float (returned when downsampling is active)
- maxValue - the corresponding maximum value as float (returned when downsampling is active)
- formattedValue - The formatted average value as displayed inside the legend
- minFormattedValue - The formatted minimum value as displayed inside the legend (returned when downsampling is active)
- maxFormattedValue - The formatted maximum value as displayed inside the legend (returned when downsampling is active)
- msgCatKey - Contains the matched config keys for the "trendStatusPattern" (optional)
- pointIcon - Path to the used icon file (optional)
If the curve is an event curve, the corresponding event data is returned as a JSON mapping, in addition to the mapping keys above.
Example
In following example, the value for the time 2018,10,24,13,07 is queried, including an offset of 4. For an example trend with the values inside the value array as described below, the value of 50 is returned inside of the returned mapping.
Example - Trend Values
[2018,10,24,13,07] 10
[2018,10,24,13,08] 20
[2018,10,24,13,09] 30
[2018,10,24,13,10] 40
[2018,10,24,13,11] 50
main(mapping event)
{
mapping data;
time t1;
int offset = 4;
string curve = "one";
t1 = makeTime(2018,10,24,13,07);
DebugN(t1);
data = TREND1.curveDataAtOffset(curve,t1,offset);
DebugN(data);
}
Assignment
Trend