Skip to content

Commit 4e5adb8

Browse files
committed
adjust fillcolor function and use it in traces
1 parent 9b12d3e commit 4e5adb8

File tree

10 files changed

+33
-24
lines changed

10 files changed

+33
-24
lines changed

src/traces/box/attributes.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22

3+
var makeFillcolorAttr = require('../scatter/fillcolor_attribute');
34
var scatterAttrs = require('../scatter/attributes');
45
var barAttrs = require('../bar/attributes');
56
var colorAttrs = require('../../components/color/attributes');
@@ -386,7 +387,7 @@ module.exports = {
386387
editType: 'plot'
387388
},
388389

389-
fillcolor: scatterAttrs.fillcolor,
390+
fillcolor: makeFillcolorAttr(),
390391

391392
whiskerwidth: {
392393
valType: 'number',

src/traces/scatter/fillcolor_attribute.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ module.exports = function makeFillcolorAttr(hasFillgradient) {
88
description: [
99
'Sets the fill color.',
1010
'Defaults to a half-transparent variant of the line color,',
11-
'marker color, or marker line color, whichever is available.',
12-
hasFillgradient ?
13-
'If fillgradient is specified, fillcolor is ignored except for setting the background color of the hover label, if any.' :
14-
''
11+
'marker color, or marker line color, whichever is available.' + (
12+
hasFillgradient ?
13+
' If fillgradient is specified, fillcolor is ignored except for setting the background color of the hover label, if any.' :
14+
''
15+
)
1516
].join(' ')
1617
};
1718
};

src/traces/scattercarpet/attributes.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22

3+
var makeFillcolorAttr = require('../scatter/fillcolor_attribute');
34
var scatterAttrs = require('../scatter/attributes');
45
var baseAttrs = require('../../plots/attributes');
56
var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs;
@@ -83,7 +84,7 @@ module.exports = {
8384
'used if one trace does not enclose the other.'
8485
].join(' ')
8586
}),
86-
fillcolor: scatterAttrs.fillcolor,
87+
fillcolor: makeFillcolorAttr(),
8788
marker: extendFlat({
8889
symbol: scatterMarkerAttrs.symbol,
8990
opacity: scatterMarkerAttrs.opacity,

src/traces/scattergeo/attributes.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs;
44
var texttemplateAttrs = require('../../plots/template_attributes').texttemplateAttrs;
5+
var makeFillcolorAttr = require('../scatter/fillcolor_attribute');
56
var scatterAttrs = require('../scatter/attributes');
67
var baseAttrs = require('../../plots/attributes');
78
var colorAttributes = require('../../components/colorscale/attributes');
@@ -151,7 +152,7 @@ module.exports = overrideAll({
151152
'of the trace if it has gaps) into a closed shape.'
152153
].join(' ')
153154
},
154-
fillcolor: scatterAttrs.fillcolor,
155+
fillcolor: makeFillcolorAttr(),
155156

156157
selected: scatterAttrs.selected,
157158
unselected: scatterAttrs.unselected,

src/traces/scattergl/attributes.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22

33
var baseAttrs = require('../../plots/attributes');
4+
var makeFillcolorAttr = require('../scatter/fillcolor_attribute');
45
var scatterAttrs = require('../scatter/attributes');
56
var axisHoverFormat = require('../../plots/cartesian/axis_format_attributes').axisHoverFormat;
67
var colorScaleAttrs = require('../../components/colorscale/attributes');
@@ -80,7 +81,7 @@ var attrs = module.exports = overrideAll({
8081
}),
8182
connectgaps: scatterAttrs.connectgaps,
8283
fill: extendFlat({}, scatterAttrs.fill, {dflt: 'none'}),
83-
fillcolor: scatterAttrs.fillcolor,
84+
fillcolor: makeFillcolorAttr(),
8485

8586
// no hoveron
8687

src/traces/scattermapbox/attributes.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs;
44
var texttemplateAttrs = require('../../plots/template_attributes').texttemplateAttrs;
5+
var makeFillcolorAttr = require('../scatter/fillcolor_attribute');
56
var scatterGeoAttrs = require('../scattergeo/attributes');
67
var scatterAttrs = require('../scatter/attributes');
78
var mapboxAttrs = require('../../plots/mapbox/layout_attributes');
@@ -151,7 +152,7 @@ module.exports = overrideAll({
151152
),
152153

153154
fill: scatterGeoAttrs.fill,
154-
fillcolor: scatterAttrs.fillcolor,
155+
fillcolor: makeFillcolorAttr(),
155156

156157
textfont: mapboxAttrs.layers.symbol.textfont,
157158
textposition: mapboxAttrs.layers.symbol.textposition,

src/traces/scatterpolar/attributes.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs;
44
var texttemplateAttrs = require('../../plots/template_attributes').texttemplateAttrs;
55
var extendFlat = require('../../lib/extend').extendFlat;
6+
var makeFillcolorAttr = require('../scatter/fillcolor_attribute');
67
var scatterAttrs = require('../scatter/attributes');
78
var baseAttrs = require('../../plots/attributes');
89
var lineAttrs = scatterAttrs.line;
@@ -112,7 +113,7 @@ module.exports = {
112113
'used if one trace does not enclose the other.'
113114
].join(' ')
114115
}),
115-
fillcolor: scatterAttrs.fillcolor,
116+
fillcolor: makeFillcolorAttr(),
116117

117118
// TODO error bars
118119
// https://stackoverflow.com/a/26597487/4068492

src/traces/scattersmith/attributes.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs;
44
var texttemplateAttrs = require('../../plots/template_attributes').texttemplateAttrs;
55
var extendFlat = require('../../lib/extend').extendFlat;
6+
var makeFillcolorAttr = require('../scatter/fillcolor_attribute');
67
var scatterAttrs = require('../scatter/attributes');
78
var baseAttrs = require('../../plots/attributes');
89
var lineAttrs = scatterAttrs.line;
@@ -68,7 +69,7 @@ module.exports = {
6869
'used if one trace does not enclose the other.'
6970
].join(' ')
7071
}),
71-
fillcolor: scatterAttrs.fillcolor,
72+
fillcolor: makeFillcolorAttr(),
7273

7374
hoverinfo: extendFlat({}, baseAttrs.hoverinfo, {
7475
flags: ['real', 'imag', 'text', 'name']

src/traces/scatterternary/attributes.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs;
44
var texttemplateAttrs = require('../../plots/template_attributes').texttemplateAttrs;
5+
var makeFillcolorAttr = require('../scatter/fillcolor_attribute');
56
var scatterAttrs = require('../scatter/attributes');
67
var baseAttrs = require('../../plots/attributes');
78
var colorScaleAttrs = require('../../components/colorscale/attributes');
@@ -112,7 +113,7 @@ module.exports = {
112113
'used if one trace does not enclose the other.'
113114
].join(' ')
114115
}),
115-
fillcolor: scatterAttrs.fillcolor,
116+
fillcolor: makeFillcolorAttr(),
116117
marker: extendFlat({
117118
symbol: scatterMarkerAttrs.symbol,
118119
opacity: scatterMarkerAttrs.opacity,

test/plot-schema.json

+12-12
Original file line numberDiff line numberDiff line change
@@ -16238,7 +16238,7 @@
1623816238
"valType": "number"
1623916239
},
1624016240
"fillcolor": {
16241-
"description": "Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available. If fillgradient is specified, fillcolor is ignored except for setting the background color of the hover label, if any.",
16241+
"description": "Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available.",
1624216242
"editType": "style",
1624316243
"valType": "color"
1624416244
},
@@ -17578,7 +17578,7 @@
1757817578
"decreasing": {
1757917579
"editType": "style",
1758017580
"fillcolor": {
17581-
"description": "Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available. If fillgradient is specified, fillcolor is ignored except for setting the background color of the hover label, if any.",
17581+
"description": "Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available.",
1758217582
"editType": "style",
1758317583
"valType": "color"
1758417584
},
@@ -17761,7 +17761,7 @@
1776117761
"increasing": {
1776217762
"editType": "style",
1776317763
"fillcolor": {
17764-
"description": "Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available. If fillgradient is specified, fillcolor is ignored except for setting the background color of the hover label, if any.",
17764+
"description": "Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available.",
1776517765
"editType": "style",
1776617766
"valType": "color"
1776717767
},
@@ -49591,7 +49591,7 @@
4959149591
]
4959249592
},
4959349593
"fillcolor": {
49594-
"description": "Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available. If fillgradient is specified, fillcolor is ignored except for setting the background color of the hover label, if any.",
49594+
"description": "Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available.",
4959549595
"editType": "style",
4959649596
"valType": "color"
4959749597
},
@@ -51493,7 +51493,7 @@
5149351493
]
5149451494
},
5149551495
"fillcolor": {
51496-
"description": "Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available. If fillgradient is specified, fillcolor is ignored except for setting the background color of the hover label, if any.",
51496+
"description": "Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available.",
5149751497
"editType": "calc",
5149851498
"valType": "color"
5149951499
},
@@ -53596,7 +53596,7 @@
5359653596
]
5359753597
},
5359853598
"fillcolor": {
53599-
"description": "Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available. If fillgradient is specified, fillcolor is ignored except for setting the background color of the hover label, if any.",
53599+
"description": "Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available.",
5360053600
"editType": "calc",
5360153601
"valType": "color"
5360253602
},
@@ -55612,7 +55612,7 @@
5561255612
]
5561355613
},
5561455614
"fillcolor": {
55615-
"description": "Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available. If fillgradient is specified, fillcolor is ignored except for setting the background color of the hover label, if any.",
55615+
"description": "Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available.",
5561655616
"editType": "calc",
5561755617
"valType": "color"
5561855618
},
@@ -56812,7 +56812,7 @@
5681256812
]
5681356813
},
5681456814
"fillcolor": {
56815-
"description": "Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available. If fillgradient is specified, fillcolor is ignored except for setting the background color of the hover label, if any.",
56815+
"description": "Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available.",
5681656816
"editType": "style",
5681756817
"valType": "color"
5681856818
},
@@ -58758,7 +58758,7 @@
5875858758
]
5875958759
},
5876058760
"fillcolor": {
58761-
"description": "Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available. If fillgradient is specified, fillcolor is ignored except for setting the background color of the hover label, if any.",
58761+
"description": "Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available.",
5876258762
"editType": "calc",
5876358763
"valType": "color"
5876458764
},
@@ -60594,7 +60594,7 @@
6059460594
]
6059560595
},
6059660596
"fillcolor": {
60597-
"description": "Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available. If fillgradient is specified, fillcolor is ignored except for setting the background color of the hover label, if any.",
60597+
"description": "Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available.",
6059860598
"editType": "style",
6059960599
"valType": "color"
6060060600
},
@@ -62538,7 +62538,7 @@
6253862538
]
6253962539
},
6254062540
"fillcolor": {
62541-
"description": "Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available. If fillgradient is specified, fillcolor is ignored except for setting the background color of the hover label, if any.",
62541+
"description": "Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available.",
6254262542
"editType": "style",
6254362543
"valType": "color"
6254462544
},
@@ -72246,7 +72246,7 @@
7224672246
"valType": "string"
7224772247
},
7224872248
"fillcolor": {
72249-
"description": "Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available. If fillgradient is specified, fillcolor is ignored except for setting the background color of the hover label, if any.",
72249+
"description": "Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available.",
7225072250
"editType": "style",
7225172251
"valType": "color"
7225272252
},

0 commit comments

Comments
 (0)