Skip to content

Commit 236e9a3

Browse files
committed
Fix calcLabelBBox to return sensible value when no label
1 parent fbb56f3 commit 236e9a3

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/plots/cartesian/axes.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -2452,7 +2452,7 @@ axes.drawOne = function(gd, ax, opts) {
24522452
var llbboxes = {};
24532453
function getLabelLevelBbox(suffix) {
24542454
var cls = axId + (suffix || 'tick');
2455-
if(!llbboxes[cls]) llbboxes[cls] = calcLabelLevelBbox(ax, cls);
2455+
if(!llbboxes[cls]) llbboxes[cls] = calcLabelLevelBbox(ax, cls, mainLinePositionShift);
24562456
return llbboxes[cls];
24572457
}
24582458

@@ -2872,7 +2872,7 @@ function getDividerVals(ax, vals) {
28722872
return out;
28732873
}
28742874

2875-
function calcLabelLevelBbox(ax, cls) {
2875+
function calcLabelLevelBbox(ax, cls, mainLinePositionShift) {
28762876
var top, bottom;
28772877
var left, right;
28782878

@@ -2897,10 +2897,9 @@ function calcLabelLevelBbox(ax, cls) {
28972897
right = Math.max(right, bb.right);
28982898
});
28992899
} else {
2900-
top = 0;
2901-
bottom = 0;
2902-
left = 0;
2903-
right = 0;
2900+
var dummyCalc = axes.makeLabelFns(ax, mainLinePositionShift);
2901+
top = bottom = dummyCalc.yFn({dx: 0, dy: 0, fontSize: 0}); // I don't know what dx, dy is
2902+
left = right = dummyCalc.xFn({dx: 0, dy: 0, fontSize: 0});
29042903
}
29052904

29062905
return {

0 commit comments

Comments
 (0)