diff options
Diffstat (limited to 'server/sonar-web/src/main/js/apps/projectActivity/utils.js')
-rw-r--r-- | server/sonar-web/src/main/js/apps/projectActivity/utils.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/utils.js b/server/sonar-web/src/main/js/apps/projectActivity/utils.js index 83d08e5a171..d4b52b6df7e 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/utils.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/utils.js @@ -19,7 +19,7 @@ */ // @flow import moment from 'moment'; -import { isEqual, sortBy } from 'lodash'; +import { chunk, flatMap, groupBy, isEqual, sortBy } from 'lodash'; import { cleanQuery, parseAsArray, @@ -122,6 +122,13 @@ export const generateSeries = ( ); }; +export const splitSeriesInGraphs = ( + series: Array<Serie>, + maxGraph: number, + maxSeries: number +): Array<Array<Serie>> => + flatMap(groupBy(series, serie => serie.type), type => chunk(type, maxSeries)).slice(0, maxGraph); + export const getSeriesMetricType = (series: Array<Serie>): string => series.length > 0 ? series[0].type : 'INT'; |