MCPcopy
hub / github.com/chart-kit/react-native-chart-kit / niceNumericDomain

Function niceNumericDomain

packages/core/src/scales/domain.ts:158–170  ·  view source on GitHub ↗
(
  domain: [number, number],
  count = 5
)

Source from the content-addressed store, hash-verified

156};
157
158export const niceNumericDomain = (
159 domain: [number, number],
160 count = 5
161): [number, number] => {
162 const [min, max] = domain;
163 const step = tickStep(min, max, count);
164
165 if (step === 0) {
166 return expandDegenerateDomain(domain);
167 }
168
169 return [Math.floor(min / step) * step, Math.ceil(max / step) * step];
170};

Callers 2

scales.test.tsFile · 0.90
resolveNumericDomainFunction · 0.85

Calls 2

tickStepFunction · 0.85
expandDegenerateDomainFunction · 0.85

Tested by

no test coverage detected