Class Datapoint
Data point abstraction. Consists of a timestamp and a double or string value
Inherited Members
Namespace: Cognite.Extensions
Assembly: Cognite.Extensions.dll
Syntax
public class Datapoint
Constructors
| Edit this page View SourceDatapoint(DateTime, bool, StatusCode?)
Creates a data point without a value. You still need to specify whether the time series it is being written to is a string or numeric time series. Default quality is bad.
Declaration
public Datapoint(DateTime timestamp, bool isString, StatusCode? statusCode = null)
Parameters
Type | Name | Description |
---|---|---|
DateTime | timestamp | Timestamp |
bool | isString | Whether the time series is string. |
StatusCode? | statusCode | BETA: set the data point status code. This is only used if the beta datapoints endpoint is used. |
Datapoint(DateTime, double, StatusCode?)
Creates a numeric data point
Declaration
public Datapoint(DateTime timestamp, double numericValue, StatusCode? statusCode = null)
Parameters
Type | Name | Description |
---|---|---|
DateTime | timestamp | Timestamp |
double | numericValue | double value |
StatusCode? | statusCode | BETA: set the data point status code. This is only used if the beta datapoints endpoint is used. |
Datapoint(DateTime, string?, StatusCode?)
Creates a string data point
Declaration
public Datapoint(DateTime timestamp, string? stringValue, StatusCode? statusCode = null)
Parameters
Type | Name | Description |
---|---|---|
DateTime | timestamp | Timestamp |
string | stringValue | string value |
StatusCode? | statusCode | BETA: set the data point status code. This is only used if the beta datapoints endpoint is used. |
Datapoint(long, bool, StatusCode?)
Creates a data point without a value. You still need to specify whether the time series it is being written to is a string or numeric time series.
Declaration
public Datapoint(long timestamp, bool isString, StatusCode? statusCode = null)
Parameters
Type | Name | Description |
---|---|---|
long | timestamp | Timestamp |
bool | isString | Whether the time series is string. |
StatusCode? | statusCode | BETA: set the data point status code. This is only used if the beta datapoints endpoint is used. |
Datapoint(long, double, StatusCode?)
Creates a numeric data point
Declaration
public Datapoint(long timestamp, double numericValue, StatusCode? statusCode = null)
Parameters
Type | Name | Description |
---|---|---|
long | timestamp | Timestamp |
double | numericValue | double value |
StatusCode? | statusCode | BETA: set the data point status code. This is only used if the beta datapoints endpoint is used. |
Datapoint(long, string?, StatusCode?)
Creates a string data point
Declaration
public Datapoint(long timestamp, string? stringValue, StatusCode? statusCode = null)
Parameters
Type | Name | Description |
---|---|---|
long | timestamp | Timestamp |
string | stringValue | string value |
StatusCode? | statusCode | BETA: set the data point status code. This is only used if the beta datapoints endpoint is used. |
Properties
| Edit this page View SourceIsString
True if datapoint is string
Declaration
public bool IsString { get; }
Property Value
Type | Description |
---|---|
bool |
NumericValue
Optional double value
Declaration
public double? NumericValue { get; }
Property Value
Type | Description |
---|---|
double? |
Status
Datapoint status code.
Declaration
public StatusCode Status { get; }
Property Value
Type | Description |
---|---|
StatusCode |
StringValue
Optional string value
Declaration
public string? StringValue { get; }
Property Value
Type | Description |
---|---|
string |
Timestamp
Timestamp in Unix time milliseconds
Declaration
public long Timestamp { get; }
Property Value
Type | Description |
---|---|
long |
Methods
| Edit this page View SourceFromStream(Stream)
Initializes Datapoint by reading from a stream. Requires that the next bytes in the stream represent a datapoint.
Declaration
public static Datapoint? FromStream(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | Stream to read from |
Returns
Type | Description |
---|---|
Datapoint |
ToStorableBytes()
Convert datapoint into an array of bytes on the form [long timestamp][boolean isString]{Either [ushort length][string value] or [double value]}
Declaration
public byte[] ToStorableBytes()
Returns
Type | Description |
---|---|
byte[] |