Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7d40224

Browse files
authored
Merge pull request#7417 from my-tien/label-spacing
Fix for#7416: Hidden ticklabels with ticklabelposition "inside" take up plot space
2 parentsd0d7638 +6c2dbd6 commit7d40224

12 files changed

+74
-14
lines changed

‎draftlogs/7417_fix.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Fix hidden ticklabels taking up plot space[[#7417](https://github.com/plotly/plotly.js/pull/7417)]

‎src/plots/cartesian/axes.js‎

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2972,11 +2972,13 @@ function calcLabelLevelBbox(ax, cls, mainLinePositionShift) {
29722972
// (like in fixLabelOverlaps) instead and use Axes.getPxPosition
29732973
// together with the makeLabelFns outputs and `tickangle`
29742974
// to compute one bbox per (tick value x tick style)
2975-
varbb=Drawing.bBox(thisLabel.node().parentNode);
2976-
top=Math.min(top,bb.top);
2977-
bottom=Math.max(bottom,bb.bottom);
2978-
left=Math.min(left,bb.left);
2979-
right=Math.max(right,bb.right);
2975+
if(thisLabel.node().style.display!=='none'){
2976+
varbb=Drawing.bBox(thisLabel.node().parentNode);
2977+
top=Math.min(top,bb.top);
2978+
bottom=Math.max(bottom,bb.bottom);
2979+
left=Math.min(left,bb.left);
2980+
right=Math.max(right,bb.right);
2981+
}
29802982
});
29812983
}else{
29822984
vardummyCalc=axes.makeLabelFns(ax,mainLinePositionShift);
@@ -3669,7 +3671,7 @@ axes.drawLabels = function(gd, ax, opts) {
36693671
'text-anchor':anchor
36703672
});
36713673

3672-
thisText.style('opacity',1);// visible
3674+
thisText.style('display',null);// visible
36733675

36743676
if(ax._adjustTickLabelsOverflow){
36753677
ax._adjustTickLabelsOverflow();
@@ -3727,9 +3729,9 @@ axes.drawLabels = function(gd, ax, opts) {
37273729

37283730
vart=thisLabel.select('text');
37293731
if(adjust){
3730-
if(hideOverflow)t.style('opacity',0);// hidden
3731-
}else{
3732-
t.style('opacity',1);// visible
3732+
if(hideOverflow)t.style('display','none');// hidden
3733+
}elseif(t.node().style.display!=='none'){
3734+
t.style('display',null);
37333735

37343736
if(side==='bottom'||side==='right'){
37353737
visibleLabelMin=Math.min(visibleLabelMin,isX ?bb.top :bb.left);
@@ -3806,7 +3808,7 @@ axes.drawLabels = function(gd, ax, opts) {
38063808
q>ax['_visibleLabelMin_'+anchorAx._id]
38073809
){
38083810
t.style('display','none');// hidden
3809-
}elseif(e.K==='tick'&&!idx){
3811+
}elseif(e.K==='tick'&&!idx&&t.node().style.display!=='none'){
38103812
t.style('display',null);// visible
38113813
}
38123814
});
-22 Bytes
Loading
-171 Bytes
Loading
5.88 KB
Loading
-694 Bytes
Loading
-1.57 KB
Loading
-1.46 KB
Loading
28.3 KB
Loading
-2.49 KB
Loading

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp