File

widgets/implementations/datapoints-table/datapoints-table-view/datapoints-table-view.service.ts

Index

Methods

Constructor

constructor(measurementService: MeasurementService)
Parameters :
Name Type Optional
measurementService MeasurementService No

Methods

adjustDate
adjustDate(date: string | Date, minutes: number, roundSeconds)

Adjusts the given date by adding the specified number of minutes and setting seconds to 0.

Example :
                  If true, the seconds will be rounded to 0.
                  If false, the seconds will be displayed as they are.
Parameters :
Name Type Optional Default value Description
date string | Date No
  • The date to be adjusted in string format.
minutes number No
  • The number of minutes to add to the date.
roundSeconds No true
  • Whether to round the seconds or not. If true, the seconds will be rounded to 0. If false, the seconds will be displayed as they are.
Returns : string

The adjusted date in ISO string format.

filterOutInactiveDatapoints
filterOutInactiveDatapoints(datapoints: KPIDetails[])

Filters out inactive data points from the given array.

Parameters :
Name Type Optional Description
datapoints KPIDetails[] No
  • The array of data points to filter.
Returns : KPIDetails[]

An array of data points that are active.

findMinMaxValues
findMinMaxValues(valuesArray: MinMaxValues[])

Finds the overall minimum and maximum values from an array of objects containing 'min' and 'max' properties.

If the array contains only one object, that object's 'min' and 'max' values will be returned.

Example :
const values = [
  { min: 1, max: 10 }
];

const result = findMinMaxValues(values); // result is { min: 1, max: 10 }

Parameters :
Name Type Optional Description
valuesArray MinMaxValues[] No
  • An array with objects, where each contains 'min' and 'max' properties.
Returns : Value | null

An object with the smallest 'min' and largest 'max' values found in the array.

generateDataPointMap
generateDataPointMap(dataList: DatapointTableItem[], columnsHeadersReferences: TableColumnHeader[])

Generates and populates a map with data points.

This function processes the provided data points and organizes them into a map structure where each key is a unique combination of date and device identifiers, and the value is an array of data points (or null values) associated with that key. This structured data is then used in the data point table to render the data appropriately.

Parameters :
Name Type Optional Description
dataList DatapointTableItem[] No
  • The list of data point table items to be processed.
columnsHeadersReferences TableColumnHeader[] No
  • The list of column headers used to determine the order and structure of the map values.
Returns : DataPointsTableMap

A map where the key is a datapoint identifier containing the date and device name, and the value is an array of data point table items or null.

Async getAllActiveSeriesDataMap
getAllActiveSeriesDataMap(datapointsValuesDataMap: DatapointsValuesDataMap, config: DatapointsTableConfig, roundSeconds: boolean)

Retrieves the active data points series data and returns it as a map.

Example :
                  If true, the seconds will be rounded to 0.
                  If false, the seconds will be displayed as they are.
Parameters :
Name Type Optional Description
datapointsValuesDataMap DatapointsValuesDataMap No
  • A map of data point sources with their associated series.
config DatapointsTableConfig No
  • The configuration of the data points table.
roundSeconds boolean No
  • Whether to round the seconds or not. If true, the seconds will be rounded to 0. If false, the seconds will be displayed as they are.
Returns : Promise<Map<string | number, ISeries>>

A Promise that resolves to a Map object with data point IDs as keys and DataObject as values or undefined when all series has forbidden access.

getColumnHeaders
getColumnHeaders(datapointsWithValues: KPIDetails[])

Creates the column headers for the devices in the data points table.

Parameters :
Name Type Optional Description
datapointsWithValues KPIDetails[] No
  • An array of data points.
Returns : TableColumnHeader[]

An array of column headers for the devices.

getDatapointsWithValues
getDatapointsWithValues(datapoints: KPIDetails[], datapointsSeriesDataMap: DatapointsSeriesDataMap)

Creates an array of DatapointsWithValues based on the provided datapoints and datapointsSeriesDataMap.

Finds an index of a current data point within series object and based on that index filters values array.

Parameters :
Name Type Optional Description
datapoints KPIDetails[] No
  • An array of data points.
datapointsSeriesDataMap DatapointsSeriesDataMap No
  • A map containing series data for data points.

An array of DatapointsWithValues.

getSeriesWithoutPermissionToRead
getSeriesWithoutPermissionToRead(activeDatapointsSeriesData: Map | undefined, activeDatapointsIdsWithSeries: DatapointsValuesDataMap)
Parameters :
Name Type Optional
activeDatapointsSeriesData Map<string | number | ISeries> | undefined No
activeDatapointsIdsWithSeries DatapointsValuesDataMap No
Returns : literal type[]
groupByDateAndDevice
groupByDateAndDevice(dataList: DatapointTableItem[], references: TableColumnHeader[])

Groups a list of data points by date and device, based on given references.

Parameters :
Name Type Optional Description
dataList DatapointTableItem[] No
  • The list of data points to be grouped.
references TableColumnHeader[] No
  • The column headers that serve as references for grouping.

An array of grouped data points, where each group corresponds to a unique date and device.

groupSeriesByDeviceId
groupSeriesByDeviceId(activeDatapoints: KPIDetails[])

Returns a map of active data points device IDs with their corresponding series.

Example output:

Example :
new Map([
  [
    "844657202",
    [
      "c8y_Temperature.T"
    ]
  ],
  [
    "32666427",
    [
      "c8y_Battery.Battery"
    ]
  ]
]);
Parameters :
Name Type Optional
activeDatapoints KPIDetails[] No

A map where the key is the data point ID and the value is an array of data point series.

hasMultipleDatapoints
hasMultipleDatapoints(datapoints: KPIDetails[])
Parameters :
Name Type Optional
datapoints KPIDetails[] No
Returns : boolean
Async loadSeriesData
loadSeriesData(params: ISeriesFilter, roundSeconds: boolean)

Asynchronously loads series data based on the provided parameters.

This method constructs a filter for retrieving series data within a specified date range, from a specific source, and optionally applying an aggregation type.

Parameters :
Name Type Optional Description
params ISeriesFilter No
  • The parameters for loading series data, including date range, source, series names, and aggregation type.
roundSeconds boolean No
  • Indicates whether to round the seconds in the date range to the nearest whole number.
Returns : Promise<IResult<ISeries>>

A promise that resolves to series data wrapped in result object.

mapDatapointsWithValuesToList
mapDatapointsWithValuesToList(datapointsWithValues: DatapointWithValues[])
Parameters :
Name Type Optional
datapointsWithValues DatapointWithValues[] No
mergeDatapoints
mergeDatapoints(map: DataPointsTableMap)

Merges the data points from the given map into an array of grouped data point table items.

Parameters :
Name Type Optional Description
map DataPointsTableMap No
  • The map containing the data points to be merged.

An array of grouped data point table items.

prepareTimeRange
prepareTimeRange(interval: TimeRangeInterval, dateFromInput: string, dateToInput: string)

Prepares the updated time range based on the selected interval.

In case of a 'custom' interval or no quantity, the original date range is returned.

Parameters :
Name Type Optional Description
interval TimeRangeInterval No
  • The selected interval type.
dateFromInput string No
dateToInput string No
Returns : literal type

An object containing the dateFrom and dateTo in ISO string format.

sortDataByDateDescending
sortDataByDateDescending(data: GroupedDatapointTableItem[])
Parameters :
Name Type Optional
data GroupedDatapointTableItem[] No
subtractTime
subtractTime(date: Date, amount: number, unit: string)

Subtracts an amount of time from a given date.

Parameters :
Name Type Optional Description
date Date No
  • The original date.
amount number No
  • The amount of time units to subtract.
unit string No
  • The unit of time to subtract (e.g., minutes, hours, days, weeks, months).
Returns : Date

A new date with the specified time subtracted.

results matching ""

    No results matching ""