Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1c0a886

Browse files
authored
Merge pull request plotly#6061 from plotly/heatmap-max-font-size
Do not exceed global font size when heatmap textfont is set to auto
2 parents abbfa7b + f0fa670 commit 1c0a886

12 files changed

+5
-2
lines changed

draftlogs/6061_fix.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Do not exceed layout font size when `textfont` is set to "auto" for `heatmap`, `histogram2d` and `contour` traces [[#6061](https://github.com/plotly/plotly.js/pull/6061)]

src/traces/heatmap/plot.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@ module.exports = function(gd, plotinfo, cdheatmaps, heatmapLayer) {
453453
var font = trace.textfont;
454454
var fontFamily = font.family;
455455
var fontSize = font.size;
456+
var globalFontSize = gd._fullLayout.font.size;
456457

457458
if(!fontSize || fontSize === 'auto') {
458459
var minW = Infinity;
@@ -479,7 +480,7 @@ module.exports = function(gd, plotinfo, cdheatmaps, heatmapLayer) {
479480
!isFinite(minW) ||
480481
!isFinite(minH)
481482
) {
482-
fontSize = 12;
483+
fontSize = globalFontSize;
483484
} else {
484485
minW -= xGap;
485486
minH -= yGap;
@@ -492,7 +493,8 @@ module.exports = function(gd, plotinfo, cdheatmaps, heatmapLayer) {
492493

493494
fontSize = Math.min(
494495
Math.floor(minW),
495-
Math.floor(minH)
496+
Math.floor(minH),
497+
globalFontSize
496498
);
497499
}
498500
}
Loading
-5.71 KB
Loading
-3.57 KB
Loading
-4.73 KB
Loading
Loading
-2.06 KB
Loading
Loading
-1.72 KB
Loading
-22.4 KB
Loading
-13.5 KB
Loading

0 commit comments

Comments
 (0)