Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Removed unnecessary function

Michael Rademaker9ced4289fd36
diff --git a/ui/component/core/src/util.ts b/ui/component/core/src/util.ts
index f76cde590..8ec3c5909 100644
--- a/ui/component/core/src/util.ts
+++ b/ui/component/core/src/util.ts
@@ -883,9 +883,3 @@ export function dispatchCancellableEvent<T>(target: EventTarget, event: CustomEv
return deferred.promise;
}
-
-//TODO: should we keep it like this?
-//Added to fill in gaps with null values
-export function filterNullValueDatapoints(data: ValueDatapoint<any>[]) {
- return data.filter(value => value.y != null);
-}
diff --git a/ui/component/or-attribute-card/src/index.ts b/ui/component/or-attribute-card/src/index.ts
index 3bb8050b8..06f551a91 100644
--- a/ui/component/or-attribute-card/src/index.ts
+++ b/ui/component/or-attribute-card/src/index.ts
@@ -272,7 +272,7 @@ export class OrAttributeCard extends LitElement {
data: {
datasets: [
{
- data: Util.filterNullValueDatapoints(this.data),
+ data: this.data.filter(value => value.y != null),
lineTension: 0.1,
spanGaps: true,
backgroundColor: "transparent",
@@ -314,7 +314,7 @@ export class OrAttributeCard extends LitElement {
});
} else {
if (changedProperties.has("data")) {
- this._chart.data.datasets![0].data = Util.filterNullValueDatapoints(this.data);
+ this._chart.data.datasets![0].data = this.data.filter(value => value.y != null);
this._chart.update();
this.delta = this.getFormattedDelta(this.getFirstKnownMeasurement(this.data), this.getLastKnownMeasurement(this.data));
}
diff --git a/ui/component/or-attribute-history/src/index.ts b/ui/component/or-attribute-history/src/index.ts
index f92ad1c91..0fa033f78 100644
--- a/ui/component/or-attribute-history/src/index.ts
+++ b/ui/component/or-attribute-history/src/index.ts
@@ -15,7 +15,7 @@ import {
import i18next from "i18next";
import {translate} from "@openremote/or-translate";
import {Attribute, AttributeRef, DatapointInterval, ValueDatapoint, ValueDescriptor} from "@openremote/model";
-import manager, {AssetModelUtil, DefaultColor2, DefaultColor3, DefaultColor4, DefaultColor5, Util} from "@openremote/core";
+import manager, {AssetModelUtil, DefaultColor2, DefaultColor3, DefaultColor4, DefaultColor5} from "@openremote/core";
import "@openremote/or-input";
import "@openremote/or-panel";
import "@openremote/or-translate";
@@ -366,7 +366,7 @@ export class OrAttributeHistory extends translate(i18next)(LitElement) {
data: {
datasets: [
{
- data: Util.filterNullValueDatapoints(this._data),
+ data: this._data.filter(value => value.y != null),
backgroundColor: bgColor,
borderColor: this._style.getPropertyValue("--internal-or-attribute-history-graph-line-color"),
pointBorderColor: this._style.getPropertyValue("--internal-or-attribute-history-graph-point-border-color"),
@@ -433,7 +433,7 @@ export class OrAttributeHistory extends translate(i18next)(LitElement) {
});
} else {
if (changedProperties.has("_data")) {
- this._chart.data.datasets![0].data = Util.filterNullValueDatapoints(this._data);;
+ this._chart.data.datasets![0].data = this._data.filter(value => value.y != null);
this._chart.update();
}
}
diff --git a/ui/component/or-chart/src/index.ts b/ui/component/or-chart/src/index.ts
index 420c3d918..fc1c9d665 100644
--- a/ui/component/or-chart/src/index.ts
+++ b/ui/component/or-chart/src/index.ts
@@ -905,7 +905,7 @@ export class OrChart extends translate(i18next)(LitElement) {
let data = this.assetAttributes.map(async (attribute, index) => {
var valuepoints = await this._loadAttributeData(this.assets[index], attribute, this.timestamp);
if (valuepoints) {
- valuepoints = Util.filterNullValueDatapoints(valuepoints);
+ valuepoints = valuepoints.filter(value => value.y != null);
}
const dataset = {...datasetBases[index],
data: valuepoints
@@ -926,7 +926,7 @@ export class OrChart extends translate(i18next)(LitElement) {
const predictedData = this.assetAttributes.map(async (attribute, index) => {
var valuepoints = await this._loadPredictedAttributeData(this.assets[index], attribute, this.timestamp);
if (valuepoints) {
- valuepoints = Util.filterNullValueDatapoints(valuepoints);
+ valuepoints = valuepoints.filter(value => value.y != null);
}
const dataset = {...datasetBases[index],
data: valuepoints,
@@ -947,7 +947,7 @@ export class OrChart extends translate(i18next)(LitElement) {
const cData = this.assetAttributes.map(async (attribute, index) => {
var valuepoints = await this._loadAttributeData(this.assets[index], attribute, this.compareTimestamp);
if (valuepoints) {
- valuepoints = Util.filterNullValueDatapoints(valuepoints);
+ valuepoints = valuepoints.filter(value => value.y != null);
}
const dataset = {...datasetBases[index],
data: valuepoints,
@@ -966,7 +966,7 @@ export class OrChart extends translate(i18next)(LitElement) {
let cPredictedData = this.assetAttributes.map(async (attribute, index) => {
var valuepoints = await this._loadPredictedAttributeData(this.assets[index], attribute, this.compareTimestamp);
if (valuepoints) {
- valuepoints = Util.filterNullValueDatapoints(valuepoints);
+ valuepoints = valuepoints.filter(value => value.y != null);
}
const dataset = {...datasetBases[index],
data: valuepoints,