-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
automatic margins for long labels #2243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
6797c9d
f83fb55
eda678d
e86cfea
8a5de93
0ef6009
412941c
bc0cf06
b2d49d5
25a36db
d89f23e
8d0a5eb
67b04e9
05b909a
a05bd81
eeb1f65
c1f7df4
48da987
504d133
ae6ec95
20bdefa
1df34bd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,8 @@ module.exports = function handleTickLabelDefaults(containerIn, containerOut, coe | |
} | ||
|
||
if(axType !== 'category' && !options.noHover) coerce('hoverformat'); | ||
|
||
if(axType === 'cartesian') coerce('ticklabelsautomargin'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh this won't work. I think the easiest way would to add an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh and does There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure what To answer your question more generally, the auto-margin calculation explicitly takes the axis title font size into account, and for the rest relies on the pre-existing bounding-box calculation. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
In brief, So, yes it is necessary 😄
Ok great. So, auto-margin doesn't just depend on tick settings like the attribute name
Ok, so this should depend on |
||
}; | ||
|
||
/* | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"data": [{ | ||
"type": "scatter", | ||
"name": "loooooong x", | ||
"x": [ | ||
"short label 1", "loooooong label 1", | ||
"short label 2", "loooooong label 2", | ||
"short label 3", "loooooong label 3", | ||
"short label 4", "loooooongloooooongloooooong label 4", | ||
"short label 5", "loooooong label 5" | ||
], | ||
"y": [ | ||
"short label 1", "loooooong label 1", | ||
"short label 2", "loooooong label 2", | ||
"short label 3", "loooooong label 3", | ||
"short label 4", "loooooong label 4", | ||
"short label 5", "loooooong label 5" | ||
] | ||
}, | ||
{ | ||
"yaxis": "y2", | ||
"type": "scatter", | ||
"name": "loooooong y", | ||
"x":["looooooooooooonger"], | ||
"y":["loooooooo"] | ||
} | ||
], | ||
"layout": { | ||
"xaxis": {"title": "X Axis Title", "titlefont": {"size": 80}, "ticklabelsautomargin": true}, | ||
"yaxis": {"title": "Y Axis Title", "titlefont": {"size": 40}, "ticklabelsautomargin": true}, | ||
"yaxis2": { | ||
"title": "Y2 Axis Title", | ||
"overlaying": "y", | ||
"side": "right", "titlefont": {"size": 40}, "ticklabelsautomargin": true | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be too verbose. Would
(x|y)axis.automargin
suffice? Or maybetickautomargin
? Or perhaps we're looking at this the wrong way, something like:might scale better.
@alexcjohnson @cldougl @chriddyp any thoughts on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for
automargin
/automarginmode
or at least(x|y)axis.automargin
- this is more clear if attributes other than ticks/tick labels contributes to this (now or in the future).