MCPcopy Index your code
hub / github.com/plotly/plotly.js / interpColor

Function interpColor

src/traces/heatmap/plot.js:220–246  ·  view source on GitHub ↗
(r0, r1, xinterp, yinterp)

Source from the content-addressed store, hash-verified

218 }
219
220 function interpColor(r0, r1, xinterp, yinterp) {
221 var z00 = r0[xinterp.bin0];
222 if (z00 === undefined) return setColor(undefined, 1);
223
224 var z01 = r0[xinterp.bin1];
225 var z10 = r1[xinterp.bin0];
226 var z11 = r1[xinterp.bin1];
227 var dx = z01 - z00 || 0;
228 var dy = z10 - z00 || 0;
229 var dxy;
230
231 // the bilinear interpolation term needs different calculations
232 // for all the different permutations of missing data
233 // among the neighbors of the main point, to ensure
234 // continuity across brick boundaries.
235 if (z01 === undefined) {
236 if (z11 === undefined) dxy = 0;
237 else if (z10 === undefined) dxy = 2 * (z11 - z00);
238 else dxy = ((2 * z11 - z10 - z00) * 2) / 3;
239 } else if (z11 === undefined) {
240 if (z10 === undefined) dxy = 0;
241 else dxy = ((2 * z00 - z01 - z10) * 2) / 3;
242 } else if (z10 === undefined) dxy = ((2 * z11 - z01 - z00) * 2) / 3;
243 else dxy = z11 + z00 - z01 - z10;
244
245 return setColor(z00 + xinterp.frac * dx + yinterp.frac * (dy + xinterp.frac * dxy));
246 }
247
248 if (drawingMethod !== 'default') {
249 // works fastest with imageData

Callers 1

plot.jsFile · 0.85

Calls 1

setColorFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…