Skip to content
This repository has been archived by the owner on Feb 19, 2022. It is now read-only.

increase verySmallNumber in single point domain calc #257

Merged
merged 1 commit into from
Jun 20, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/victory-util/domain.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down