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

Function getDomainState

src/ui-react-dom-charts/common/data.ts:336–378  ·  view source on GitHub ↗
(summaries: SeriesSummary[])

Source from the content-addressed store, hash-verified

334};
335
336export const getDomainState = (summaries: SeriesSummary[]): DomainState => {
337 const xValues: XValue[] = [];
338 const xMins: number[] = [];
339 const xMaxes: number[] = [];
340 const yMins: number[] = [];
341 const yMaxes: number[] = [];
342 let continuousX = true;
343 let xMin: XValue | undefined;
344 let xMax: XValue | undefined;
345
346 arrayForEach(summaries, (summary) => {
347 continuousX &&= summary.continuousX;
348 arrayForEach(summary.xValues, (xValue) => {
349 if (!arrayHas(xValues, xValue)) {
350 arrayPush(xValues, xValue);
351 }
352 });
353 if (isNumber(summary.xMin) && isNumber(summary.xMax)) {
354 arrayPush(xMins, summary.xMin);
355 arrayPush(xMaxes, summary.xMax);
356 } else {
357 xMin ??= summary.xMin;
358 xMax = summary.xMax ?? xMax;
359 }
360 if (!isUndefined(summary.yMin)) {
361 arrayPush(yMins, summary.yMin);
362 }
363 if (!isUndefined(summary.yMax)) {
364 arrayPush(yMaxes, summary.yMax);
365 }
366 });
367
368 return {
369 bounds: [
370 arrayIsEmpty(xMins) ? xMin : mathMin(...xMins),
371 arrayIsEmpty(xMaxes) ? xMax : mathMax(...xMaxes),
372 arrayIsEmpty(yMins) ? undefined : mathMin(...yMins),
373 arrayIsEmpty(yMaxes) ? undefined : mathMax(...yMaxes),
374 ],
375 continuousX: !arrayIsEmpty(summaries) && continuousX,
376 xValues,
377 };
378};
379
380export const getYDomain = (
381 points: (DataPoint | ScaledPoint)[],

Callers 1

CartesianChartFunction · 0.90

Calls 6

arrayForEachFunction · 0.90
arrayHasFunction · 0.90
arrayPushFunction · 0.90
isNumberFunction · 0.90
isUndefinedFunction · 0.90
arrayIsEmptyFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…