Skip to content

Commit

Permalink
Merge pull request #6061 from plotly/heatmap-max-font-size
Browse files Browse the repository at this point in the history
Do not exceed global font size when heatmap textfont is set to auto
  • Loading branch information
archmoj committed Dec 15, 2021
2 parents abbfa7b + f0fa670 commit 1c0a886
Show file tree
Hide file tree
Showing 12 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions draftlogs/6061_fix.md
Original file line number Diff line number Diff line change
@@ -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)]
6 changes: 4 additions & 2 deletions src/traces/heatmap/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -479,7 +480,7 @@ module.exports = function(gd, plotinfo, cdheatmaps, heatmapLayer) {
!isFinite(minW) ||
!isFinite(minH)
) {
fontSize = 12;
fontSize = globalFontSize;
} else {
minW -= xGap;
minH -= yGap;
Expand All @@ -492,7 +493,8 @@ module.exports = function(gd, plotinfo, cdheatmaps, heatmapLayer) {

fontSize = Math.min(
Math.floor(minW),
Math.floor(minH)
Math.floor(minH),
globalFontSize
);
}
}
Expand Down
Binary file modified test/image/baselines/contour_heatmap_coloring_reversescale.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/heatmap_brick_padding.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/heatmap_categoryorder.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/heatmap_columnar.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/heatmap_xyz-gaps-on-sides.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/hist2d_summed.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/histogram2d_bingroup-coloraxis.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/histogram2d_bingroup.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/histogram2d_legend.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/zsmooth_methods.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1c0a886

Please sign in to comment.