kibana-123
Version:
Kibana is an open source (Apache Licensed), browser based analytics and search dashboard for Elasticsearch. Kibana is a snap to setup and start using. Kibana strives to be easy to get started with, while also being flexible and powerful, just like Elastic
30 lines (24 loc) • 628 B
JavaScript
import _ from 'lodash';
define(function () {
return function ZeroFilledArrayUtilService() {
/*
* Accepts an array of x axis values (strings or numbers).
* Returns a zero filled array.
*/
return function (arr, label) {
if (!_.isArray(arr)) {
throw new Error('ZeroFilledArrayUtilService expects an array of strings or numbers');
}
const zeroFilledArray = [];
arr.forEach(function (val) {
zeroFilledArray.push({
x: val,
xi: Infinity,
y: 0,
series: label
});
});
return zeroFilledArray;
};
};
});