Skip to content

Commit a2400f1

Browse files
committed
add moduleHasFillgradient option to fillColorDefaults
1 parent d9bd365 commit a2400f1

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

src/traces/scatter/defaults.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
7272
// We handle that case in some hacky code inside handleStackDefaults.
7373
coerce('fill', stackGroupOpts ? stackGroupOpts.fillDflt : 'none');
7474
if(traceOut.fill !== 'none') {
75-
handleFillColorDefaults(traceIn, traceOut, defaultColor, coerce);
75+
handleFillColorDefaults(traceIn, traceOut, defaultColor, coerce, {
76+
moduleHasFillgradient: true
77+
});
7678
if(!subTypes.hasLines(traceOut)) handleLineShapeDefaults(traceIn, traceOut, coerce);
7779
coercePattern(coerce, 'fillpattern', traceOut.fillcolor, false);
7880
}

src/traces/scatter/fillcolor_defaults.js

+17-13
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ function averageColors(colorscale) {
1212
return color;
1313
}
1414

15-
module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coerce) {
15+
module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coerce, opts) {
16+
if(!opts) opts = {};
17+
1618
var inheritColorFromMarker = false;
1719

1820
if(traceOut.marker) {
@@ -28,18 +30,20 @@ module.exports = function fillColorDefaults(traceIn, traceOut, defaultColor, coe
2830
}
2931

3032
var averageGradientColor;
31-
var gradientOrientation = coerce('fillgradient.type');
32-
if(gradientOrientation !== 'none') {
33-
coerce('fillgradient.start');
34-
coerce('fillgradient.stop');
35-
var gradientColorscale = coerce('fillgradient.colorscale');
36-
37-
// if a fillgradient is specified, we use the average gradient color
38-
// to specify fillcolor after all other more specific candidates
39-
// are considered, but before the global default color.
40-
// fillcolor affects the background color of the hoverlabel in this case.
41-
if(gradientColorscale) {
42-
averageGradientColor = averageColors(gradientColorscale);
33+
if(opts.moduleHasFillgradient) {
34+
var gradientOrientation = coerce('fillgradient.type');
35+
if(gradientOrientation !== 'none') {
36+
coerce('fillgradient.start');
37+
coerce('fillgradient.stop');
38+
var gradientColorscale = coerce('fillgradient.colorscale');
39+
40+
// if a fillgradient is specified, we use the average gradient color
41+
// to specify fillcolor after all other more specific candidates
42+
// are considered, but before the global default color.
43+
// fillcolor affects the background color of the hoverlabel in this case.
44+
if(gradientColorscale) {
45+
averageGradientColor = averageColors(gradientColorscale);
46+
}
4347
}
4448
}
4549

0 commit comments

Comments
 (0)