-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathattributes.js
164 lines (156 loc) · 5.5 KB
/
attributes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/**
* Copyright 2012-2017, Plotly, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
var heatmapAttrs = require('../heatmap/attributes');
var scatterAttrs = require('../scatter/attributes');
var colorscaleAttrs = require('../../components/colorscale/attributes');
var colorbarAttrs = require('../../components/colorbar/attributes');
var dash = require('../../components/drawing/attributes').dash;
var fontAttrs = require('../../plots/font_attributes');
var extendFlat = require('../../lib/extend').extendFlat;
var scatterLineAttrs = scatterAttrs.line;
module.exports = extendFlat({}, {
z: heatmapAttrs.z,
x: heatmapAttrs.x,
x0: heatmapAttrs.x0,
dx: heatmapAttrs.dx,
y: heatmapAttrs.y,
y0: heatmapAttrs.y0,
dy: heatmapAttrs.dy,
text: heatmapAttrs.text,
transpose: heatmapAttrs.transpose,
xtype: heatmapAttrs.xtype,
ytype: heatmapAttrs.ytype,
connectgaps: heatmapAttrs.connectgaps,
autocontour: {
valType: 'boolean',
dflt: true,
role: 'style',
description: [
'Determines whether or not the contour level attributes are',
'picked by an algorithm.',
'If *true*, the number of contour levels can be set in `ncontours`.',
'If *false*, set the contour level attributes in `contours`.'
].join(' ')
},
ncontours: {
valType: 'integer',
dflt: 15,
min: 1,
role: 'style',
description: [
'Sets the maximum number of contour levels. The actual number',
'of contours will be chosen automatically to be less than or',
'equal to the value of `ncontours`.',
'Has an effect only if `autocontour` is *true* or if',
'`contours.size` is missing.'
].join(' ')
},
contours: {
start: {
valType: 'number',
dflt: null,
role: 'style',
description: [
'Sets the starting contour level value.',
'Must be less than `contours.end`'
].join(' ')
},
end: {
valType: 'number',
dflt: null,
role: 'style',
description: [
'Sets the end contour level value.',
'Must be more than `contours.start`'
].join(' ')
},
size: {
valType: 'number',
dflt: null,
min: 0,
role: 'style',
description: [
'Sets the step between each contour level.',
'Must be positive.'
].join(' ')
},
coloring: {
valType: 'enumerated',
values: ['fill', 'heatmap', 'lines', 'none'],
dflt: 'fill',
role: 'style',
description: [
'Determines the coloring method showing the contour values.',
'If *fill*, coloring is done evenly between each contour level',
'If *heatmap*, a heatmap gradient coloring is applied',
'between each contour level.',
'If *lines*, coloring is done on the contour lines.',
'If *none*, no coloring is applied on this trace.'
].join(' ')
},
showlines: {
valType: 'boolean',
dflt: true,
role: 'style',
description: [
'Determines whether or not the contour lines are drawn.',
'Has an effect only if `contours.coloring` is set to *fill*.'
].join(' ')
},
showlabels: {
valType: 'boolean',
dflt: false,
role: 'style',
description: [
'Determines whether to label the contour lines with their values.'
].join(' ')
},
font: extendFlat({}, fontAttrs, {
description: [
'Sets the font used for labeling the contour levels.',
'The default color comes from the lines, if shown.',
// TODO: same size as layout.font, or smaller? 80%?
'The default family and size come from `layout.font`.'
].join(' ')
}),
labelformat: {
valType: 'string',
dflt: '',
role: 'style',
description: [
'Sets the contour label formatting rule using d3 formatting',
'mini-language which is very similar to Python, see:',
'https://github.com/d3/d3-format/blob/master/README.md#locale_format.'
].join(' ')
}
},
line: {
color: extendFlat({}, scatterLineAttrs.color, {
description: [
'Sets the color of the contour level.',
'Has no if `contours.coloring` is set to *lines*.'
].join(' ')
}),
width: scatterLineAttrs.width,
dash: dash,
smoothing: extendFlat({}, scatterLineAttrs.smoothing, {
description: [
'Sets the amount of smoothing for the contour lines,',
'where *0* corresponds to no smoothing.'
].join(' ')
})
}
},
colorscaleAttrs, {
autocolorscale: extendFlat({}, colorscaleAttrs.autocolorscale, {dflt: false}),
zmin: extendFlat({}, colorscaleAttrs.zmin, {editType: 'docalc'}),
zmax: extendFlat({}, colorscaleAttrs.zmax, {editType: 'docalc'})
},
{ colorbar: colorbarAttrs }
);