MCPcopy Index your code
hub / github.com/ChartGPU/ChartGPU / computeVisibleXDomain

Function computeVisibleXDomain

src/core/createRenderCoordinator.ts:1287–1304  ·  view source on GitHub ↗
(
  baseXDomain: { readonly min: number; readonly max: number },
  zoomRange?: ZoomRange | null
)

Source from the content-addressed store, hash-verified

1285};
1286
1287const computeVisibleXDomain = (
1288 baseXDomain: { readonly min: number; readonly max: number },
1289 zoomRange?: ZoomRange | null
1290): { readonly min: number; readonly max: number; readonly spanFraction: number } => {
1291 if (!zoomRange) return { ...baseXDomain, spanFraction: 1 };
1292 const span = baseXDomain.max - baseXDomain.min;
1293 if (!Number.isFinite(span) || span === 0) return { ...baseXDomain, spanFraction: 1 };
1294
1295 const start = zoomRange.start;
1296 const end = zoomRange.end;
1297 const xMin = baseXDomain.min + (start / 100) * span;
1298 const xMax = baseXDomain.min + (end / 100) * span;
1299 const normalized = normalizeDomain(xMin, xMax);
1300
1301 const fractionRaw = (end - start) / 100;
1302 const spanFraction = Number.isFinite(fractionRaw) ? Math.max(0, Math.min(1, fractionRaw)) : 1;
1303 return { min: normalized.min, max: normalized.max, spanFraction };
1304};
1305
1306type IntroPhase = 'pending' | 'running' | 'done';
1307

Callers 6

flushPendingAppendsFunction · 0.85
recomputeRenderSeriesFunction · 0.85
setOptionsFunction · 0.85
renderFunction · 0.85

Calls 1

normalizeDomainFunction · 0.70

Tested by

no test coverage detected