fix multiple agg functions handling, closes #530

This commit is contained in:
Alexander Zobnin
2019-03-07 10:35:36 +03:00
parent 3428137f7c
commit e4bbecb18b
4 changed files with 52 additions and 4 deletions

View File

@@ -478,6 +478,15 @@ function findNearestLeft(series, pointIndex) {
return null;
}
function flattenDatapoints(datapoints) {
const depth = utils.getArrayDepth(datapoints);
if (depth <= 2) {
// Don't process if datapoints already flattened
return datapoints;
}
return _.flatten(datapoints);
}
////////////
// Export //
////////////
@@ -501,7 +510,8 @@ const exportedFunctions = {
MAX,
MEDIAN,
PERCENTIL,
sortByTime
sortByTime,
flattenDatapoints,
};
export default exportedFunctions;