diff --git a/src/utils/src/filter-utils.ts b/src/utils/src/filter-utils.ts index 8e2cd3a4ca..6d21af6098 100644 --- a/src/utils/src/filter-utils.ts +++ b/src/utils/src/filter-utils.ts @@ -742,6 +742,10 @@ export function getTimestampFieldDomain( let step = 0.01; const diff = domain[1] - domain[0]; + // in case equal timestamp add 1 second padding to prevent break + if (!diff) { + domain[1] = domain[0] + 1000; + } const entry = TimestampStepMap.find(f => f.max >= diff); if (entry) { step = entry.step; diff --git a/test/node/utils/filter-utils-test.js b/test/node/utils/filter-utils-test.js index ecb1ac2bc5..351bd19b7a 100644 --- a/test/node/utils/filter-utils-test.js +++ b/test/node/utils/filter-utils-test.js @@ -478,7 +478,7 @@ test('filterUtils -> getTimestampFieldDomain', t => { zero: { input: ['2016-10-01 09:45:39', '2016-10-01 09:45:39'], expect: { - domain: [1475315139000, 1475315139000], + domain: [1475315139000, 1475315140000], mappedValue: [1475315139000, 1475315139000], histogram: [{count: 2, x0: 1475315139000, x1: 1475315139000}], enlargedHistogram: [{count: 2, x0: 1475315139000, x1: 1475315139000}],