MCPcopy Index your code
hub / github.com/tinyplex/tinybase / getXScaleDomain

Function getXScaleDomain

src/ui-react-dom-charts/common/data.ts:247–265  ·  view source on GitHub ↗
(
  [xMin, xMax]: Bounds,
  xValues: XValue[],
  xScale: XScale,
  timestampUnit: TimestampUnit,
)

Source from the content-addressed store, hash-verified

245 : CATEGORY;
246
247export const getXScaleDomain = (
248 [xMin, xMax]: Bounds,
249 xValues: XValue[],
250 xScale: XScale,
251 timestampUnit: TimestampUnit,
252): readonly [xMin?: XValue, xMax?: XValue] => {
253 const timestamps: number[] = [];
254 return xScale == LINEAR
255 ? [isNumber(xMin) ? xMin : undefined, isNumber(xMax) ? xMax : undefined]
256 : xScale == TIME
257 ? (arrayForEach(xValues, (xValue) => {
258 const timestamp = normalizeTimeValue(xValue, timestampUnit);
259 if (isFiniteNumber(timestamp)) {
260 arrayPush(timestamps, timestamp as number);
261 }
262 }),
263 arrayIsEmpty(timestamps) ? [] : getDomain(timestamps))
264 : [xMin, xMax];
265};
266
267export const normalizeTimeValue = (
268 value: unknown,

Callers 1

getAxisBoundsFunction · 0.90

Calls 6

isNumberFunction · 0.90
arrayForEachFunction · 0.90
arrayPushFunction · 0.90
arrayIsEmptyFunction · 0.90
normalizeTimeValueFunction · 0.70
getDomainFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…