Skip to content

Commit 71dc6b7

Browse files
committed
use labelLength to position multicategory ax titles
... replacing (buggy) ax._boundingBox. This fixes ax title placement on multicategory axes with mirror ticks
1 parent 07d73df commit 71dc6b7

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

src/plots/cartesian/axes.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1803,6 +1803,7 @@ axes.drawOne = function(gd, ax, opts) {
18031803

18041804
seq.push(function() {
18051805
labelLength += getLabelLevelSpan(ax, axId + 'tick2');
1806+
ax._labelLength = labelLength;
18061807

18071808
return drawDividers(gd, ax, {
18081809
vals: dividerVals,
@@ -2608,7 +2609,7 @@ function drawTitle(gd, ax) {
26082609

26092610
var titleStandoff;
26102611
if(ax.type === 'multicategory') {
2611-
titleStandoff = ax._boundingBox[{x: 'height', y: 'width'}[axLetter]];
2612+
titleStandoff = ax._labelLength;
26122613
} else {
26132614
var offsetBase = 1.5;
26142615
titleStandoff = 10 + fontSize * offsetBase + (ax.linewidth ? ax.linewidth - 1 : 0);
1.88 KB
Loading

test/image/mocks/multicategory-mirror.json

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
],
2020
"layout": {
2121
"xaxis": {
22+
"title": "MULTI-CATEGORY",
2223
"ticks": "outside",
2324
"showline": true,
2425
"mirror": "ticks",

0 commit comments

Comments
 (0)