Skip to content

Commit db7ecc9

Browse files
committed
fixup contour heatmap labels
1 parent 5e9520d commit db7ecc9

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

src/traces/heatmap/plot.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -366,12 +366,19 @@ module.exports = function(gd, plotinfo, cdheatmaps, heatmapLayer) {
366366
_numFormat: xa._numFormat
367367
};
368368

369-
var isHistogram2dContour = trace.type === 'histogram2dcontour';
369+
var aHistogram2dContour = trace.type === 'histogram2dcontour';
370+
var aContour = trace.type === 'contour';
371+
var iStart = aContour ? 1 : 0;
372+
var iStop = aContour ? m - 1 : m;
373+
var jStart = aContour ? 1 : 0;
374+
var jStop = aContour ? n - 1 : n;
370375

371376
var textData = [];
372-
for(i = 0; i < m; i++) {
377+
for(i = iStart; i < iStop; i++) {
373378
var yVal;
374-
if(isHistogram2dContour) {
379+
if(aContour) {
380+
yVal = cd0.y[i];
381+
} else if(aHistogram2dContour) {
375382
if(i === 0 || i === m - 1) continue;
376383
yVal = cd0.y[i];
377384
} else if(cd0.yCenter) {
@@ -384,9 +391,11 @@ module.exports = function(gd, plotinfo, cdheatmaps, heatmapLayer) {
384391
var _y = Math.round(ya.c2p(yVal));
385392
if(0 > _y || _y > ya._length) continue;
386393

387-
for(j = 0; j < n; j++) {
394+
for(j = jStart; j < jStop; j++) {
388395
var xVal;
389-
if(isHistogram2dContour) {
396+
if(aContour) {
397+
xVal = cd0.x[j];
398+
} else if(aHistogram2dContour) {
390399
if(j === 0 || j === n - 1) continue;
391400
xVal = cd0.x[j];
392401
} else if(cd0.xCenter) {
-7.46 KB
Loading
-3.4 KB
Loading

0 commit comments

Comments
 (0)