mirror of
https://github.com/grafana/grafana.git
synced 2024-11-25 18:30:41 -06:00
fix(tooltip): msdetection can now handle null data points
This commit is contained in:
parent
b6ac0860c6
commit
98e756e278
@ -171,11 +171,13 @@ export default class TimeSeries {
|
||||
|
||||
isMsResolutionNeeded() {
|
||||
for (var i = 0; i<this.datapoints.length; i++) {
|
||||
if (this.datapoints[i][0] !== null) {
|
||||
var timestamp = this.datapoints[i][0].toString();
|
||||
if (timestamp.length === 13 && (timestamp % 1000) !== 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -56,6 +56,26 @@ define([
|
||||
});
|
||||
});
|
||||
|
||||
describe('can detect if serie contains ms precision', function() {
|
||||
var fakedata;
|
||||
|
||||
beforeEach(function() {
|
||||
fakedata = testData;
|
||||
});
|
||||
|
||||
it('missing datapoint with ms precision', function() {
|
||||
fakedata.datapoints[0] = [1234567890000, 1337];
|
||||
series = new TimeSeries(fakedata);
|
||||
expect(series.isMsResolutionNeeded()).to.be(false);
|
||||
});
|
||||
|
||||
it('contains datapoint with ms precision', function() {
|
||||
fakedata.datapoints[0] = [1236547890001, 1337];
|
||||
series = new TimeSeries(fakedata);
|
||||
expect(series.isMsResolutionNeeded()).to.be(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('series overrides', function() {
|
||||
var series;
|
||||
beforeEach(function() {
|
||||
@ -148,7 +168,5 @@ define([
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user