moved the adition of the start and end time of the series after the reduce function checks each data point from elastic search. This whould resolve #422
This commit is contained in:
+21
-10
@@ -457,6 +457,10 @@ angular.module('kibana.histogram', [])
|
|||||||
return parseInt(val, 10);
|
return parseInt(val, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getDatesTime(date) {
|
||||||
|
return Math.floor(date.getTime() / 1000)*1000
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Certain graphs require 0 entries to be specified for them to render
|
* Certain graphs require 0 entries to be specified for them to render
|
||||||
* properly (like the line graph). So with this we will caluclate all of
|
* properly (like the line graph). So with this we will caluclate all of
|
||||||
@@ -474,7 +478,7 @@ angular.module('kibana.histogram', [])
|
|||||||
* the series.
|
* the series.
|
||||||
*/
|
*/
|
||||||
this.ZeroFilled = function (opts) {
|
this.ZeroFilled = function (opts) {
|
||||||
this.opts = _.defaults(opts, {
|
opts = _.defaults(opts, {
|
||||||
interval: '10m',
|
interval: '10m',
|
||||||
start_date: null,
|
start_date: null,
|
||||||
end_date: null,
|
end_date: null,
|
||||||
@@ -486,13 +490,9 @@ angular.module('kibana.histogram', [])
|
|||||||
|
|
||||||
// will keep all values here, keyed by their time
|
// will keep all values here, keyed by their time
|
||||||
this._data = {};
|
this._data = {};
|
||||||
|
this.start_time = opts.start_date && getDatesTime(opts.start_date);
|
||||||
if (opts.start_date) {
|
this.end_time = opts.end_date && getDatesTime(opts.end_date);
|
||||||
this.addValue(opts.start_date, null);
|
this.opts = opts;
|
||||||
}
|
|
||||||
if (opts.end_date) {
|
|
||||||
this.addValue(opts.end_date, null);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -502,7 +502,7 @@ angular.module('kibana.histogram', [])
|
|||||||
*/
|
*/
|
||||||
this.ZeroFilled.prototype.addValue = function (time, value) {
|
this.ZeroFilled.prototype.addValue = function (time, value) {
|
||||||
if (time instanceof Date) {
|
if (time instanceof Date) {
|
||||||
time = Math.floor(time.getTime() / 1000)*1000;
|
time = getDatesTime(time);
|
||||||
} else {
|
} else {
|
||||||
time = base10Int(time);
|
time = base10Int(time);
|
||||||
}
|
}
|
||||||
@@ -544,12 +544,23 @@ angular.module('kibana.histogram', [])
|
|||||||
strategy = this._getMinFlotPairs;
|
strategy = this._getMinFlotPairs;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _.reduce(
|
pairs = _.reduce(
|
||||||
times, // what
|
times, // what
|
||||||
strategy, // how
|
strategy, // how
|
||||||
[], // where
|
[], // where
|
||||||
this // context
|
this // context
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// if the start and end of the pairs are inside either the start or end time,
|
||||||
|
// add those times to the series with null values so the graph will stretch to contain them.
|
||||||
|
if (this.start_time && pairs[0][0] > this.start_time) {
|
||||||
|
pairs.unshift([this.start_time, null]);
|
||||||
|
}
|
||||||
|
if (this.end_time && pairs[pairs.length -1][0] < this.end_time) {
|
||||||
|
pairs.push([this.end_time, null]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return pairs;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user