Skip to content

Commit 0f029e1

Browse files
committed
Fix heatmap rendering (zsmooth=fast)
1 parent 3f8cfe7 commit 0f029e1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/traces/heatmap/plot.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,9 @@ module.exports = function(gd, plotinfo, cdheatmaps, heatmapLayer) {
240240
var pixels;
241241

242242
try {
243-
pixels = new Uint8Array(imageWidth * imageHeight * 4);
243+
pixels = new Uint8Array(canvasW * canvasH * 4);
244244
} catch(e) {
245-
pixels = new Array(imageWidth * imageHeight * 4);
245+
pixels = new Array(canvasW * canvasH * 4);
246246
}
247247

248248
if(zsmooth === 'best') {
@@ -277,15 +277,15 @@ module.exports = function(gd, plotinfo, cdheatmaps, heatmapLayer) {
277277
for(j = 0; j < m; j++) {
278278
row = z[j];
279279
yb = ypx(j);
280-
for(i = 0; i < imageWidth; i++) {
280+
for(i = 0; i < n; i++) {
281281
c = setColor(row[i], 1);
282-
pxIndex = (yb * imageWidth + xpx(i)) * 4;
282+
pxIndex = (yb * n + xpx(i)) * 4;
283283
putColor(pixels, pxIndex, c);
284284
}
285285
}
286286
}
287287

288-
var imageData = context.createImageData(imageWidth, imageHeight);
288+
var imageData = context.createImageData(canvasW, canvasH);
289289
try {
290290
imageData.data.set(pixels);
291291
} catch(e) {

0 commit comments

Comments
 (0)