Commit 98e756e2 by bergquist

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

parent b6ac0860
......@@ -171,9 +171,11 @@ export default class TimeSeries {
isMsResolutionNeeded() {
for (var i = 0; i<this.datapoints.length; i++) {
var timestamp = this.datapoints[i][0].toString();
if (timestamp.length === 13 && (timestamp % 1000) !== 0) {
return true;
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([
});
});
});
});
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