diff --git a/draftlogs/6061_fix.md b/draftlogs/6061_fix.md new file mode 100644 index 00000000000..8f96f9eb2b0 --- /dev/null +++ b/draftlogs/6061_fix.md @@ -0,0 +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)] diff --git a/src/traces/heatmap/plot.js b/src/traces/heatmap/plot.js index 1db9318bd4c..f77f097d066 100644 --- a/src/traces/heatmap/plot.js +++ b/src/traces/heatmap/plot.js @@ -453,6 +453,7 @@ module.exports = function(gd, plotinfo, cdheatmaps, heatmapLayer) { var font = trace.textfont; var fontFamily = font.family; var fontSize = font.size; + var globalFontSize = gd._fullLayout.font.size; if(!fontSize || fontSize === 'auto') { var minW = Infinity; @@ -479,7 +480,7 @@ module.exports = function(gd, plotinfo, cdheatmaps, heatmapLayer) { !isFinite(minW) || !isFinite(minH) ) { - fontSize = 12; + fontSize = globalFontSize; } else { minW -= xGap; minH -= yGap; @@ -492,7 +493,8 @@ module.exports = function(gd, plotinfo, cdheatmaps, heatmapLayer) { fontSize = Math.min( Math.floor(minW), - Math.floor(minH) + Math.floor(minH), + globalFontSize ); } } diff --git a/test/image/baselines/contour_heatmap_coloring_reversescale.png b/test/image/baselines/contour_heatmap_coloring_reversescale.png index 97cc01d6d91..b14417224c9 100644 Binary files a/test/image/baselines/contour_heatmap_coloring_reversescale.png and b/test/image/baselines/contour_heatmap_coloring_reversescale.png differ diff --git a/test/image/baselines/heatmap_brick_padding.png b/test/image/baselines/heatmap_brick_padding.png index b8620ac7c74..41f917be325 100644 Binary files a/test/image/baselines/heatmap_brick_padding.png and b/test/image/baselines/heatmap_brick_padding.png differ diff --git a/test/image/baselines/heatmap_categoryorder.png b/test/image/baselines/heatmap_categoryorder.png index a76a54c1641..ced6e1875ca 100644 Binary files a/test/image/baselines/heatmap_categoryorder.png and b/test/image/baselines/heatmap_categoryorder.png differ diff --git a/test/image/baselines/heatmap_columnar.png b/test/image/baselines/heatmap_columnar.png index 04d545dea86..14be707733a 100644 Binary files a/test/image/baselines/heatmap_columnar.png and b/test/image/baselines/heatmap_columnar.png differ diff --git a/test/image/baselines/heatmap_xyz-gaps-on-sides.png b/test/image/baselines/heatmap_xyz-gaps-on-sides.png index 66aae47f18d..3247642795f 100644 Binary files a/test/image/baselines/heatmap_xyz-gaps-on-sides.png and b/test/image/baselines/heatmap_xyz-gaps-on-sides.png differ diff --git a/test/image/baselines/hist2d_summed.png b/test/image/baselines/hist2d_summed.png index 49680d69708..6d7e8eda766 100644 Binary files a/test/image/baselines/hist2d_summed.png and b/test/image/baselines/hist2d_summed.png differ diff --git a/test/image/baselines/histogram2d_bingroup-coloraxis.png b/test/image/baselines/histogram2d_bingroup-coloraxis.png index f88342bc1ce..9fed38448d2 100644 Binary files a/test/image/baselines/histogram2d_bingroup-coloraxis.png and b/test/image/baselines/histogram2d_bingroup-coloraxis.png differ diff --git a/test/image/baselines/histogram2d_bingroup.png b/test/image/baselines/histogram2d_bingroup.png index 9fc00b968e4..e8b0be607a8 100644 Binary files a/test/image/baselines/histogram2d_bingroup.png and b/test/image/baselines/histogram2d_bingroup.png differ diff --git a/test/image/baselines/histogram2d_legend.png b/test/image/baselines/histogram2d_legend.png index 242d4d68d16..2d00c636643 100644 Binary files a/test/image/baselines/histogram2d_legend.png and b/test/image/baselines/histogram2d_legend.png differ diff --git a/test/image/baselines/zsmooth_methods.png b/test/image/baselines/zsmooth_methods.png index cf25b9e281e..ce62857e007 100644 Binary files a/test/image/baselines/zsmooth_methods.png and b/test/image/baselines/zsmooth_methods.png differ