Offset function added (#638)

* Shift function added

* Remane shift function to offset
This commit is contained in:
drakosha
2018-11-28 17:30:51 +03:00
committed by Alexander Zobnin
parent f5cb445b7a
commit e36336864a
4 changed files with 33 additions and 0 deletions

View File

@@ -191,6 +191,17 @@ function scale_perf(datapoints, factor) {
return datapoints;
}
function offset(datapoints, delta) {
for (let i = 0; i < datapoints.length; i++) {
datapoints[i] = [
datapoints[i][POINT_VALUE] + delta,
datapoints[i][POINT_TIMESTAMP]
];
}
return datapoints;
}
/**
* Simple delta. Calculate value delta between points.
* @param {*} datapoints
@@ -477,6 +488,7 @@ const exportedFunctions = {
groupBy_perf,
sumSeries,
scale,
offset,
scale_perf,
delta,
rate,