MCPcopy
hub / github.com/ChartGPU/ChartGPU / scale

Function scale

src/utils/scales.ts:107–116  ·  view source on GitHub ↗
(value: number)

Source from the content-addressed store, hash-verified

105 },
106
107 scale(value: number) {
108 if (!Number.isFinite(value)) return Number.NaN;
109
110 if (domainMin === domainMax) {
111 return (rangeMin + rangeMax) / 2;
112 }
113
114 const t = (value - domainMin) / (domainMax - domainMin);
115 return rangeMin + t * (rangeMax - rangeMin);
116 },
117
118 invert(pixel: number) {
119 if (!Number.isFinite(pixel)) return Number.NaN;

Callers

nothing calls this directly

Calls 1

categoryIndexMethod · 0.80

Tested by

no test coverage detected