Skip to content

Commit fe7a30a

Browse files
committed
set auto shadow for sankey, parcats and parcoords that has text-shadow before
1 parent 1b67344 commit fe7a30a

File tree

11 files changed

+15
-11
lines changed

11 files changed

+15
-11
lines changed

src/lib/coerce.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,9 +469,15 @@ exports.coerceFont = function(coerce, attr, dfltObj, opts) {
469469
out.weight = coerce(attr + '.weight', dfltObj.weight);
470470
out.style = coerce(attr + '.style', dfltObj.style);
471471
if(!opts.noFontVariant) out.variant = coerce(attr + '.variant', dfltObj.variant);
472-
if(!opts.noFontShadow) out.shadow = coerce(attr + '.shadow', dfltObj.shadow);
473472
if(!opts.noFontStriding) out.striding = coerce(attr + '.striding', dfltObj.striding);
474473
if(!opts.noFontCapitalize) out.capitalize = coerce(attr + '.capitalize', dfltObj.capitalize);
474+
if(!opts.noFontShadow) {
475+
var dfltShadow = dfltObj.shadow;
476+
if(dfltShadow === 'none' && opts.autoShadowDflt) {
477+
dfltShadow = 'auto';
478+
}
479+
out.shadow = coerce(attr + '.shadow', dfltShadow);
480+
}
475481

476482
return out;
477483
};

src/plots/font_attributes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ module.exports = function(opts) {
114114
shadow: opts.noFontShadow ? undefined : {
115115
editType: editType,
116116
valType: 'string',
117-
dflt: 'none',
117+
dflt: opts.autoShadowDflt ? 'auto' : 'none',
118118
extras: ['auto'],
119119
description: [
120120
'Sets the shape and color of the shadow behind text.',

src/traces/parcats/attributes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ module.exports = {
105105
}),
106106

107107
tickfont: fontAttrs({
108+
autoShadowDflt: true,
108109
editType: 'calc',
109110
description: 'Sets the font for the `category` labels.'
110111
}),

src/traces/parcats/defaults.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,5 +121,5 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
121121
color: layout.font.color
122122
};
123123

124-
Lib.coerceFont(coerce, 'tickfont', categoryfontDefault);
124+
Lib.coerceFont(coerce, 'tickfont', categoryfontDefault, { autoShadowDflt: true });
125125
};

src/traces/parcats/parcats.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,6 @@ function performPlot(parcatsModels, graphDiv, layout, svg) {
225225
.attr('class', 'catlabel')
226226
.attr('pointer-events', 'none');
227227

228-
var paperColor = graphDiv._fullLayout.paper_bgcolor;
229-
230228
// Update category label
231229
categorySelection.select('text.catlabel')
232230
.attr('text-anchor',
@@ -240,8 +238,6 @@ function performPlot(parcatsModels, graphDiv, layout, svg) {
240238
}
241239
})
242240
.attr('alignment-baseline', 'middle')
243-
244-
.style('text-shadow', svgTextUtils.makeTextShadow(paperColor))
245241
.style('fill', 'rgb(0, 0, 0)')
246242
.attr('x',
247243
function(d) {

src/traces/parcoords/attributes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ module.exports = {
4242
description: 'Sets the font for the `dimension` labels.'
4343
}),
4444
tickfont: fontAttrs({
45+
autoShadowDflt: true,
4546
editType: 'plot',
4647
description: 'Sets the font for the `dimension` tick values.'
4748
}),

src/traces/parcoords/defaults.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
108108
};
109109

110110
Lib.coerceFont(coerce, 'labelfont', fontDflt);
111-
Lib.coerceFont(coerce, 'tickfont', fontDflt);
111+
Lib.coerceFont(coerce, 'tickfont', fontDflt, { autoShadowDflt: true });
112112
Lib.coerceFont(coerce, 'rangefont', fontDflt);
113113

114114
coerce('labelangle');

src/traces/parcoords/parcoords.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,6 @@ module.exports = function parcoords(gd, cdModule, layout, callbacks) {
661661
.attr('stroke-width', '1px');
662662

663663
axis.selectAll('text')
664-
.style('text-shadow', svgTextUtils.makeTextShadow(paperColor))
665664
.style('cursor', 'default');
666665

667666
var axisHeading = axisOverlays.selectAll('.' + c.cn.axisHeading)

src/traces/sankey/attributes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ var attrs = module.exports = overrideAll({
6464
},
6565

6666
textfont: fontAttrs({
67+
autoShadowDflt: true,
6768
description: 'Sets the font for node labels'
6869
}),
6970

src/traces/sankey/defaults.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
106106
}
107107
coerce('arrangement', dfltArrangement);
108108

109-
Lib.coerceFont(coerce, 'textfont', Lib.extendFlat({}, layout.font));
109+
var fontDflt = Lib.extendFlat({}, layout.font);
110+
Lib.coerceFont(coerce, 'textfont', fontDflt, { autoShadowDflt: true });
110111

111112
// disable 1D transforms - arrays here are 1D but their lengths/meanings
112113
// don't match, between nodes and links

0 commit comments

Comments
 (0)