Skip to content

Commit b08caf7

Browse files
committed
centralize big font logic
1 parent e748072 commit b08caf7

File tree

7 files changed

+10
-6
lines changed

7 files changed

+10
-6
lines changed

src/components/legend/defaults.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) {
122122
if(titleText) {
123123
coerce('title.side', isHorizontal ? 'left' : 'top');
124124
var dfltTitleFont = Lib.extendFlat({}, itemFont, {
125-
size: Math.round(itemFont.size * 1.2)
125+
size: Lib.bigFont(itemFont.size)
126126
});
127127

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

src/lib/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,3 +1263,7 @@ lib.join2 = function(arr, mainSeparator, lastSeparator) {
12631263
}
12641264
return arr.join(mainSeparator);
12651265
};
1266+
1267+
lib.bigFont = function(size) {
1268+
return Math.round(1.2 * size);
1269+
};

src/plots/cartesian/axes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ axes.prepTicks = function(ax, opts) {
554554

555555
if(!nt) {
556556
if(ax.type === 'category' || ax.type === 'multicategory') {
557-
minPx = ax.tickfont ? (ax.tickfont.size || 12) * 1.2 : 15;
557+
minPx = ax.tickfont ? Lib.bigFont(ax.tickfont.size || 12) : 15;
558558
nt = ax._length / minPx;
559559
} else {
560560
minPx = ax._id.charAt(0) === 'y' ? 40 : 80;

src/plots/cartesian/axis_defaults.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce,
116116
coerce('title.text', dfltTitle);
117117
Lib.coerceFont(coerce, 'title.font', {
118118
family: font.family,
119-
size: Math.round(font.size * 1.2),
119+
size: Lib.bigFont(font.size),
120120
color: dfltFontColor
121121
});
122122

src/plots/polar/layout_defaults.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ function handleDefaults(contIn, contOut, coerce, opts) {
9898
coerceAxis('title.text');
9999
Lib.coerceFont(coerceAxis, 'title.font', {
100100
family: opts.font.family,
101-
size: Math.round(opts.font.size * 1.2),
101+
size: Lib.bigFont(opts.font.size),
102102
color: dfltFontColor
103103
});
104104
}

src/plots/ternary/layout_defaults.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ function handleAxisDefaults(containerIn, containerOut, options, ternaryLayoutOut
8282

8383
Lib.coerceFont(coerce, 'title.font', {
8484
family: options.font.family,
85-
size: Math.round(options.font.size * 1.2),
85+
size: Lib.bigFont(options.font.size),
8686
color: dfltFontColor
8787
});
8888

src/traces/carpet/axis_defaults.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, options)
110110
if(title) {
111111
Lib.coerceFont(coerce, 'title.font', {
112112
family: font.family,
113-
size: Math.round(font.size * 1.2),
113+
size: Lib.bigFont(font.size),
114114
color: dfltFontColor
115115
});
116116
coerce('title.offset');

0 commit comments

Comments
 (0)