Skip to content

Commit bc9f70a

Browse files
committed
581a dry colors - contour
1 parent e5222d0 commit bc9f70a

File tree

2 files changed

+95
-100
lines changed

2 files changed

+95
-100
lines changed

src/traces/contour/attributes.js

+94-98
Original file line numberDiff line numberDiff line change
@@ -10,116 +10,112 @@
1010

1111
var heatmapAttrs = require('../heatmap/attributes');
1212
var scatterAttrs = require('../scatter/attributes');
13+
var colorscaleAttrs = require('../../components/colorscale/attributes');
1314
var extendFlat = require('../../lib/extend').extendFlat;
1415

1516
var scatterLineAttrs = scatterAttrs.line;
1617

17-
module.exports = {
18-
z: heatmapAttrs.z,
19-
x: heatmapAttrs.x,
20-
x0: heatmapAttrs.x0,
21-
dx: heatmapAttrs.dx,
22-
y: heatmapAttrs.y,
23-
y0: heatmapAttrs.y0,
24-
dy: heatmapAttrs.dy,
25-
text: heatmapAttrs.text,
26-
transpose: heatmapAttrs.transpose,
27-
xtype: heatmapAttrs.xtype,
28-
ytype: heatmapAttrs.ytype,
18+
module.exports = extendFlat({},
19+
colorscaleAttrs,
20+
{autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false})},
21+
{
22+
z: heatmapAttrs.z,
23+
x: heatmapAttrs.x,
24+
x0: heatmapAttrs.x0,
25+
dx: heatmapAttrs.dx,
26+
y: heatmapAttrs.y,
27+
y0: heatmapAttrs.y0,
28+
dy: heatmapAttrs.dy,
29+
text: heatmapAttrs.text,
30+
transpose: heatmapAttrs.transpose,
31+
xtype: heatmapAttrs.xtype,
32+
ytype: heatmapAttrs.ytype,
2933

30-
zauto: heatmapAttrs.zauto,
31-
zmin: heatmapAttrs.zmin,
32-
zmax: heatmapAttrs.zmax,
33-
colorscale: heatmapAttrs.colorscale,
34-
autocolorscale: heatmapAttrs.autocolorscale,
35-
reversescale: heatmapAttrs.reversescale,
36-
showscale: heatmapAttrs.showscale,
34+
connectgaps: heatmapAttrs.connectgaps,
3735

38-
connectgaps: heatmapAttrs.connectgaps,
39-
40-
autocontour: {
41-
valType: 'boolean',
42-
dflt: true,
43-
role: 'style',
44-
description: [
45-
'Determines whether or not the contour level attributes are',
46-
'picked by an algorithm.',
47-
'If *true*, the number of contour levels can be set in `ncontours`.',
48-
'If *false*, set the contour level attributes in `contours`.'
49-
].join(' ')
50-
},
51-
ncontours: {
52-
valType: 'integer',
53-
dflt: 0,
54-
role: 'style',
55-
description: [
56-
'Sets the number of contour levels.',
57-
'Has an effect only if `autocontour` is *true*.'
58-
].join(' ')
59-
},
60-
61-
contours: {
62-
start: {
63-
valType: 'number',
64-
dflt: null,
65-
role: 'style',
66-
description: 'Sets the starting contour level value.'
67-
},
68-
end: {
69-
valType: 'number',
70-
dflt: null,
71-
role: 'style',
72-
description: 'Sets the end contour level value.'
73-
},
74-
size: {
75-
valType: 'number',
76-
dflt: null,
77-
role: 'style',
78-
description: 'Sets the step between each contour level.'
79-
},
80-
coloring: {
81-
valType: 'enumerated',
82-
values: ['fill', 'heatmap', 'lines', 'none'],
83-
dflt: 'fill',
36+
autocontour: {
37+
valType: 'boolean',
38+
dflt: true,
8439
role: 'style',
8540
description: [
86-
'Determines the coloring method showing the contour values.',
87-
'If *fill*, coloring is done evenly between each contour level',
88-
'If *heatmap*, a heatmap gradient coloring is applied',
89-
'between each contour level.',
90-
'If *lines*, coloring is done on the contour lines.',
91-
'If *none*, no coloring is applied on this trace.'
41+
'Determines whether or not the contour level attributes are',
42+
'picked by an algorithm.',
43+
'If *true*, the number of contour levels can be set in `ncontours`.',
44+
'If *false*, set the contour level attributes in `contours`.'
9245
].join(' ')
9346
},
94-
showlines: {
95-
valType: 'boolean',
96-
dflt: true,
47+
ncontours: {
48+
valType: 'integer',
49+
dflt: 0,
9750
role: 'style',
9851
description: [
99-
'Determines whether or not the contour lines are drawn.',
100-
'Has only an effect if `contours.coloring` is set to *fill*.'
52+
'Sets the number of contour levels.',
53+
'Has an effect only if `autocontour` is *true*.'
10154
].join(' ')
102-
}
103-
},
55+
},
10456

105-
line: {
106-
color: extendFlat({}, scatterLineAttrs.color, {
107-
description: [
108-
'Sets the color of the contour level.',
109-
'Has no if `contours.coloring` is set to *lines*.'
110-
].join(' ')
111-
}),
112-
width: scatterLineAttrs.width,
113-
dash: scatterLineAttrs.dash,
114-
smoothing: extendFlat({}, scatterLineAttrs.smoothing, {
115-
description: [
116-
'Sets the amount of smoothing for the contour lines,',
117-
'where *0* corresponds to no smoothing.'
118-
].join(' ')
119-
})
120-
},
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+
},
121100

122-
_nestedModules: {
123-
'colorbar': 'Colorbar'
124-
}
125-
};
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'
120+
}
121+
});

src/traces/surface/attributes.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9-
109
'use strict';
1110

1211
var Color = require('../../components/color');
1312
var colorscaleAttrs = require('../../components/colorscale/attributes');
1413
var extendFlat = require('../../lib/extend').extendFlat;
1514

16-
1715
function makeContourProjAttr(axLetter) {
1816
return {
1917
valType: 'boolean',
@@ -121,6 +119,7 @@ module.exports = {
121119
].join(' ')
122120
},
123121

122+
// Todo this block has a structure of colorscale/attributes.js but with colorscale/color_attributes.js names
124123
cauto: colorscaleAttrs.zauto,
125124
cmin: colorscaleAttrs.zmin,
126125
cmax: colorscaleAttrs.zmax,

0 commit comments

Comments
 (0)