8000 New defaults for colorbar.title.font and legend.title.font to depend on colorbar.tickfont and legend.font and increase their sizes by archmoj · Pull Request #5611 · plotly/plotly.js · GitHub
[go: up one dir, main page]

Skip to content

New defaults for colorbar.title.font and legend.title.font to depend on colorbar.tickfont and legend.font and increase their sizes #5611

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

Merged
merged 13 commits into from
May 5, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
base legend.title.font.size on legend.font not layout.font and defaul…
…t to 20% gt for h legends
  • Loading branch information
archmoj committed Apr 26, 2021
commit 8ca58409b1fa74ec593b6c292e07ac734cb97362
5 changes: 4 additions & 1 deletion src/components/legend/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,10 @@ module.exports = {
font: fontAttrs({
editType: 'legend',
description: [
'Sets this legend\'s title font.'
'Sets this legend\'s title font.',
'Defaulted to `legend.font`.',
'When `orientation` is *h*, the size would be defaulted to be',
'20% greater than the font size used for legend items.'
].join(' '),
}),
side: {
Expand Down
13 changes: 9 additions & 4 deletions src/components/legend/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,13 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) {
coerce('bgcolor', layoutOut.paper_bgcolor);
coerce('bordercolor');
coerce('borderwidth');
Lib.coerceFont(coerce, 'font', layoutOut.font);
var itemFont = Lib.coerceFont(coerce, 'font', layoutOut.font);

var orientation = coerce('orientation');
var isHorizontal = orientation === 'h';
var defaultX, defaultY, defaultYAnchor;

if(orientation === 'h') {
if(isHorizontal) {
defaultX = 0;

if(Registry.getComponentMethod('rangeslider', 'isVisible')(layoutIn.xaxis)) {
Expand Down Expand Up @@ -119,7 +120,11 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) {

var titleText = coerce('title.text');
if(titleText) {
coerce('title.side', orientation === 'h' ? 'left' : 'top');
Lib.coerceFont(coerce, 'title.font', layoutOut.font);
coerce('title.side', isHorizontal ? 'left' : 'top');
var dfltTitleFont = Lib.extendFlat({}, itemFont, {
size: itemFont.size * (isHorizontal ? 1.2 : 1)
});

Lib.coerceFont(coerce, 'title.font', dfltTitleFont);
}
};
0