Skip to content

Commit 8214577

Browse files
committed
schema: rm _nestedAttributes abstraction in trace modules
- instead require attribute module into trace attribute modules directly.
1 parent 2897167 commit 8214577

File tree

15 files changed

+233
-247
lines changed

15 files changed

+233
-247
lines changed

src/traces/bar/attributes.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
var scatterAttrs = require('../scatter/attributes');
1212
var colorAttributes = require('../../components/colorscale/color_attributes');
13+
var errorBarAttrs = require('../../components/errorbars/attributes');
14+
var colorbarAttrs = require('../../components/colorbar/attributes');
15+
1316
var extendFlat = require('../../lib/extend').extendFlat;
1417

1518
var scatterMarkerAttrs = scatterAttrs.marker;
@@ -23,9 +26,11 @@ var markerLine = extendFlat({}, {
2326
}, colorAttributes('marker.line'));
2427

2528
var marker = extendFlat({}, {
26-
showscale: scatterMarkerAttrs.showscale,
2729
line: markerLine
28-
}, colorAttributes('marker'));
30+
}, colorAttributes('marker'), {
31+
showscale: scatterMarkerAttrs.showscale,
32+
colorbar: colorbarAttrs
33+
});
2934

3035

3136
module.exports = {
@@ -91,11 +96,8 @@ module.exports = {
9196
r: scatterAttrs.r,
9297
t: scatterAttrs.t,
9398

94-
_nestedModules: { // nested module coupling
95-
'error_y': 'ErrorBars',
96-
'error_x': 'ErrorBars',
97-
'marker.colorbar': 'Colorbar'
98-
},
99+
error_y: errorBarAttrs,
100+
error_x: errorBarAttrs,
99101

100102
_deprecated: {
101103
bardir: {

src/traces/choropleth/attributes.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
var ScatterGeoAttrs = require('../scattergeo/attributes');
1212
var colorscaleAttrs = require('../../components/colorscale/attributes');
13+
var colorbarAttrs = require('../../components/colorbar/attributes');
1314
var plotAttrs = require('../../plots/attributes');
15+
1416
var extendFlat = require('../../lib/extend').extendFlat;
1517

1618
var ScatterGeoMarkerLineAttrs = ScatterGeoAttrs.marker.line;
@@ -41,9 +43,7 @@ module.exports = extendFlat({}, {
4143
hoverinfo: extendFlat({}, plotAttrs.hoverinfo, {
4244
flags: ['location', 'z', 'text', 'name']
4345
}),
44-
_nestedModules: {
45-
'colorbar': 'Colorbar'
46-
}
4746
},
48-
colorscaleAttrs
47+
colorscaleAttrs,
48+
{ colorbar: colorbarAttrs }
4949
);

src/traces/contour/attributes.js

+91-94
Original file line numberDiff line numberDiff line change
@@ -11,114 +11,111 @@
1111
var heatmapAttrs = require('../heatmap/attributes');
1212
var scatterAttrs = require('../scatter/attributes');
1313
var colorscaleAttrs = require('../../components/colorscale/attributes');
14+
var colorbarAttrs = require('../../components/colorbar/attributes');
1415
var extendFlat = require('../../lib/extend').extendFlat;
1516

1617
var scatterLineAttrs = scatterAttrs.line;
1718

18-
module.exports = extendFlat({},
19-
{
20-
z: heatmapAttrs.z,
21-
x: heatmapAttrs.x,
22-
x0: heatmapAttrs.x0,
23-
dx: heatmapAttrs.dx,
24-
y: heatmapAttrs.y,
25-
y0: heatmapAttrs.y0,
26-
dy: heatmapAttrs.dy,
27-
text: heatmapAttrs.text,
28-
transpose: heatmapAttrs.transpose,
29-
xtype: heatmapAttrs.xtype,
30-
ytype: heatmapAttrs.ytype,
19+
module.exports = extendFlat({}, {
20+
z: heatmapAttrs.z,
21+
x: heatmapAttrs.x,
22+
x0: heatmapAttrs.x0,
23+
dx: heatmapAttrs.dx,
24+
y: heatmapAttrs.y,
25+
y0: heatmapAttrs.y0,
26+
dy: heatmapAttrs.dy,
27+
text: heatmapAttrs.text,
28+
transpose: heatmapAttrs.transpose,
29+
xtype: heatmapAttrs.xtype,
30+
ytype: heatmapAttrs.ytype,
3131

32-
connectgaps: heatmapAttrs.connectgaps,
32+
connectgaps: heatmapAttrs.connectgaps,
3333

34-
autocontour: {
35-
valType: 'boolean',
36-
dflt: true,
34+
autocontour: {
35+
valType: 'boolean',
36+
dflt: true,
37+
role: 'style',
38+
description: [
39+
'Determines whether or not the contour level attributes are',
40+
'picked by an algorithm.',
41+
'If *true*, the number of contour levels can be set in `ncontours`.',
42+
'If *false*, set the contour level attributes in `contours`.'
43+
].join(' ')
44+
},
45+
ncontours: {
46+
valType: 'integer',
47+
dflt: 0,
48+
role: 'style',
49+
description: [
50+
'Sets the maximum number of contour levels. The actual number',
51+
'of contours will be chosen automatically to be less than or',
52+
'equal to the value of `ncontours`.',
53+
'Has an effect only if `autocontour` is *true*.'
54+
].join(' ')
55+
},
56+
57+
contours: {
58+
start: {
59+
valType: 'number',
60+
dflt: null,
61+
role: 'style',
62+
description: 'Sets the starting contour level value.'
63+
},
64+
end: {
65+
valType: 'number',
66+
dflt: null,
67+
role: 'style',
68+
description: 'Sets the end contour level value.'
69+
},
70+
size: {
71+
valType: 'number',
72+
dflt: null,
73+
role: 'style',
74+
description: 'Sets the step between each contour level.'
75+
},
76+
coloring: {
77+
valType: 'enumerated',
78+
values: ['fill', 'heatmap', 'lines', 'none'],
79+
dflt: 'fill',
3780
role: 'style',
3881
description: [
39-
'Determines whether or not the contour level attributes are',
40-
'picked by an algorithm.',
41-
'If *true*, the number of contour levels can be set in `ncontours`.',
42-
'If *false*, set the contour level attributes in `contours`.'
82+
'Determines the coloring method showing the contour values.',
83+
'If *fill*, coloring is done evenly between each contour level',
84+
'If *heatmap*, a heatmap gradient coloring is applied',
85+
'between each contour level.',
86+
'If *lines*, coloring is done on the contour lines.',
87+
'If *none*, no coloring is applied on this trace.'
4388
].join(' ')
4489
},
45-
ncontours: {
46-
valType: 'integer',
47-
dflt: 0,
90+
showlines: {
91+
valType: 'boolean',
92+
dflt: true,
4893
role: 'style',
4994
description: [
50-
'Sets the maximum number of contour levels. The actual number',
51-
'of contours will be chosen automatically to be less than or',
52-
'equal to the value of `ncontours`.',
53-
'Has an effect only if `autocontour` is *true*.'
95+
'Determines whether or not the contour lines are drawn.',
96+
'Has only an effect if `contours.coloring` is set to *fill*.'
5497
].join(' ')
55-
},
56-
57-
contours: {
58-
start: {
59-
valType: 'number',
60-
dflt: null,
61-
role: 'style',
62-
description: 'Sets the starting contour level value.'
63-
},
64-
end: {
65-
valType: 'number',
66-
dflt: null,
67-
role: 'style',
68-
description: 'Sets the end contour level value.'
69-
},
70-
size: {
71-
valType: 'number',
72-
dflt: null,
73-
role: 'style',
74-
description: 'Sets the step between each contour level.'
75-
},
76-
coloring: {
77-
valType: 'enumerated',
78-
values: ['fill', 'heatmap', 'lines', 'none'],
79-
dflt: 'fill',
80-
role: 'style',
81-
description: [
82-
'Determines the coloring method showing the contour values.',
83-
'If *fill*, coloring is done evenly between each contour level',
84-
'If *heatmap*, a heatmap gradient coloring is applied',
85-
'between each contour level.',
86-
'If *lines*, coloring is done on the contour lines.',
87-
'If *none*, no coloring is applied on this trace.'
88-
].join(' ')
89-
},
90-
showlines: {
91-
valType: 'boolean',
92-
dflt: true,
93-
role: 'style',
94-
description: [
95-
'Determines whether or not the contour lines are drawn.',
96-
'Has only an effect if `contours.coloring` is set to *fill*.'
97-
].join(' ')
98-
}
99-
},
100-
101-
line: {
102-
color: extendFlat({}, scatterLineAttrs.color, {
103-
description: [
104-
'Sets the color of the contour level.',
105-
'Has no if `contours.coloring` is set to *lines*.'
106-
].join(' ')
107-
}),
108-
width: scatterLineAttrs.width,
109-
dash: scatterLineAttrs.dash,
110-
smoothing: extendFlat({}, scatterLineAttrs.smoothing, {
111-
description: [
112-
'Sets the amount of smoothing for the contour lines,',
113-
'where *0* corresponds to no smoothing.'
114-
].join(' ')
115-
})
116-
},
117-
118-
_nestedModules: {
119-
'colorbar': 'Colorbar'
12098
}
12199
},
100+
101+
line: {
102+
color: extendFlat({}, scatterLineAttrs.color, {
103+
description: [
104+
'Sets the color of the contour level.',
105+
'Has no if `contours.coloring` is set to *lines*.'
106+
].join(' ')
107+
}),
108+
width: scatterLineAttrs.width,
109+
dash: scatterLineAttrs.dash,
110+
smoothing: extendFlat({}, scatterLineAttrs.smoothing, {
111+
description: [
112+
'Sets the amount of smoothing for the contour lines,',
113+
'where *0* corresponds to no smoothing.'
114+
].join(' ')
115+
})
116+
}
117+
},
122118
colorscaleAttrs,
123-
{autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false})}
119+
{ autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false}) },
120+
{ colorbar: colorbarAttrs }
124121
);

0 commit comments

Comments
 (0)