Skip to content

Commit 6d858ad

Browse files
committed
improve fit
1 parent b179558 commit 6d858ad

File tree

7 files changed

+8
-4
lines changed

7 files changed

+8
-4
lines changed

src/plots/cartesian/axes.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3884,9 +3884,13 @@ axes.drawLabels = function(gd, ax, opts) {
38843884

38853885
var p0 = anchorAx.d2p(anchorAx.range[index]);
38863886
var p1 = anchorAx.d2p(anchorAx.range[otherIndex]);
3887-
38883887
var dist = Math.abs(p1 - p0);
3889-
move *= 1 + move / dist;
3888+
if(dist - move > 0) {
3889+
dist -= move;
3890+
move *= 1 + move / dist;
3891+
} else {
3892+
move = 0;
3893+
}
38903894

38913895
if(ax._id.charAt(0) !== 'y') move = -move;
38923896

-5.27 KB
Loading
1.02 KB
Loading
-4.07 KB
Loading
-181 Bytes
Loading

test/image/mocks/zz-insiderange-x-narrow.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
},
8888
"plot_bgcolor": "lightblue",
8989
"showlegend": false,
90-
"width": 360,
90+
"width": 300,
9191
"height": 900,
9292
"margin": {
9393
"t": 60,

test/image/mocks/zz-insiderange-y-narrow.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
"plot_bgcolor": "lightblue",
8989
"showlegend": false,
9090
"width": 900,
91-
"height": 360,
91+
"height": 300,
9292
"margin": {
9393
"t": 60,
9494
"b": 60,

0 commit comments

Comments
 (0)