From a96eb8efa91ddd24b279baef0f7340ee1b2bfd7d Mon Sep 17 00:00:00 2001 From: boygirl Date: Mon, 19 Jun 2017 15:31:32 -0700 Subject: [PATCH] increase verySmallNumber in single point domain calc --- src/victory-util/domain.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/victory-util/domain.js b/src/victory-util/domain.js index 6b0322c..197253a 100644 --- a/src/victory-util/domain.js +++ b/src/victory-util/domain.js @@ -125,7 +125,9 @@ export default { }, getSinglePointDomain(val) { - const verySmallNumber = 1 / Number.MAX_SAFE_INTEGER; + // d3-scale does not properly resolve very small differences. + // eslint-disable-next-line no-magic-numbers + const verySmallNumber = Math.pow(10, -15); const adjustedMin = val instanceof Date ? new Date(val - 1) : val - verySmallNumber; const adjustedMax = val instanceof Date ? new Date(val + 1) : val + verySmallNumber; return [adjustedMin, adjustedMax];