timeseries.js refactor
This commit is contained in:
@@ -5,8 +5,8 @@ import ts from './timeseries';
|
||||
let downsampleSeries = ts.downsample;
|
||||
let groupBy = ts.groupBy;
|
||||
let sumSeries = ts.sumSeries;
|
||||
let scale = ts.scale;
|
||||
let delta = ts.delta;
|
||||
let scale = (factor, datapoints) => ts.scale(datapoints, factor);
|
||||
|
||||
let SUM = ts.SUM;
|
||||
let COUNT = ts.COUNT;
|
||||
@@ -63,19 +63,19 @@ function extractText(str, pattern) {
|
||||
|
||||
function groupByWrapper(interval, groupFunc, datapoints) {
|
||||
var groupByCallback = aggregationFunctions[groupFunc];
|
||||
return groupBy(interval, groupByCallback, datapoints);
|
||||
return groupBy(datapoints, interval, groupByCallback);
|
||||
}
|
||||
|
||||
function aggregateByWrapper(interval, aggregateFunc, datapoints) {
|
||||
// Flatten all points in frame and then just use groupBy()
|
||||
var flattenedPoints = _.flatten(datapoints, true);
|
||||
var groupByCallback = aggregationFunctions[aggregateFunc];
|
||||
return groupBy(interval, groupByCallback, flattenedPoints);
|
||||
return groupBy(flattenedPoints, interval, groupByCallback);
|
||||
}
|
||||
|
||||
function aggregateWrapper(groupByCallback, interval, datapoints) {
|
||||
var flattenedPoints = _.flatten(datapoints, true);
|
||||
return groupBy(interval, groupByCallback, flattenedPoints);
|
||||
return groupBy(flattenedPoints, interval, groupByCallback);
|
||||
}
|
||||
|
||||
function timeShift(interval, range) {
|
||||
|
||||
Reference in New Issue
Block a user