Commit 98e756e2 by bergquist

fix(tooltip): msdetection can now handle null data points

parent b6ac0860
...@@ -171,9 +171,11 @@ export default class TimeSeries { ...@@ -171,9 +171,11 @@ export default class TimeSeries {
isMsResolutionNeeded() { isMsResolutionNeeded() {
for (var i = 0; i<this.datapoints.length; i++) { for (var i = 0; i<this.datapoints.length; i++) {
var timestamp = this.datapoints[i][0].toString(); if (this.datapoints[i][0] !== null) {
if (timestamp.length === 13 && (timestamp % 1000) !== 0) { var timestamp = this.datapoints[i][0].toString();
return true; if (timestamp.length === 13 && (timestamp % 1000) !== 0) {
return true;
}
} }
} }
return false; return false;
......
...@@ -56,6 +56,26 @@ define([ ...@@ -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() { describe('series overrides', function() {
var series; var series;
beforeEach(function() { beforeEach(function() {
...@@ -148,7 +168,5 @@ define([ ...@@ -148,7 +168,5 @@ define([
}); });
}); });
}); });
}); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment