-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathattributes.js
170 lines (150 loc) · 6.14 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
165
166
167
168
169
170
/**
* 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 contourAttrs = require('../contour/attributes');
var contourContourAttrs = contourAttrs.contours;
var scatterAttrs = require('../scatter/attributes');
var colorscaleAttrs = require('../../components/colorscale/attributes');
var colorbarAttrs = require('../../components/colorbar/attributes');
var extendFlat = require('../../lib/extend').extendFlat;
var scatterLineAttrs = scatterAttrs.line;
var constants = require('./constants');
module.exports = extendFlat({}, {
carpet: {
valType: 'string',
role: 'info',
description: [
'The `carpet` of the carpet axes on which this contour trace lies'
].join(' ')
},
z: heatmapAttrs.z,
a: heatmapAttrs.x,
a0: heatmapAttrs.x0,
da: heatmapAttrs.dx,
b: heatmapAttrs.y,
b0: heatmapAttrs.y0,
db: heatmapAttrs.dy,
text: heatmapAttrs.text,
transpose: heatmapAttrs.transpose,
atype: heatmapAttrs.xtype,
btype: heatmapAttrs.ytype,
mode: {
valType: 'flaglist',
flags: ['lines', 'fill'],
extras: ['none'],
role: 'info',
description: ['The mode.'].join(' ')
},
connectgaps: heatmapAttrs.connectgaps,
fillcolor: {
valType: 'color',
role: 'style',
description: [
'Sets the fill color.',
'Defaults to a half-transparent variant of the line color,',
'marker color, or marker line color, whichever is available.'
].join(' ')
},
autocontour: contourAttrs.autocontour,
ncontours: contourAttrs.ncontours,
contours: {
type: {
valType: 'enumerated',
values: ['levels', 'constraint'],
dflt: 'levels',
role: 'info',
description: [
'If `levels`, the data is represented as a contour plot with multiple',
'levels displayed. If `constraint`, the data is represented as constraints',
'with the invalid region shaded as specified by the `operation` and',
'`value` parameters.'
].join(' ')
},
start: contourContourAttrs.start,
end: contourContourAttrs.end,
size: contourContourAttrs.size,
coloring: {
// from contourAttrs.contours.coloring but no 'heatmap' option
valType: 'enumerated',
values: ['fill', '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 *lines*, coloring is done on the contour lines.',
'If *none*, no coloring is applied on this trace.'
].join(' ')
},
showlines: contourContourAttrs.showlines,
operation: {
valType: 'enumerated',
values: [].concat(constants.INEQUALITY_OPS).concat(constants.INTERVAL_OPS).concat(constants.SET_OPS),
role: 'info',
dflt: '=',
description: [
'Sets the filter operation.',
'*=* keeps items equal to `value`',
'*<* keeps items less than `value`',
'*<=* keeps items less than or equal to `value`',
'*>* keeps items greater than `value`',
'*>=* keeps items greater than or equal to `value`',
'*[]* keeps items inside `value[0]` to value[1]` including both bounds`',
'*()* keeps items inside `value[0]` to value[1]` excluding both bounds`',
'*[)* keeps items inside `value[0]` to value[1]` including `value[0]` but excluding `value[1]',
'*(]* keeps items inside `value[0]` to value[1]` excluding `value[0]` but including `value[1]',
'*][* keeps items outside `value[0]` to value[1]` and equal to both bounds`',
'*)(* keeps items outside `value[0]` to value[1]`',
'*](* keeps items outside `value[0]` to value[1]` and equal to `value[0]`',
'*)[* keeps items outside `value[0]` to value[1]` and equal to `value[1]`'
].join(' ')
},
value: {
valType: 'any',
dflt: 0,
role: 'info',
description: [
'Sets the value or values by which to filter by.',
'Values are expected to be in the same type as the data linked',
'to *target*.',
'When `operation` is set to one of the inequality values',
'(' + constants.INEQUALITY_OPS + ')',
'*value* is expected to be a number or a string.',
'When `operation` is set to one of the interval value',
'(' + constants.INTERVAL_OPS + ')',
'*value* is expected to be 2-item array where the first item',
'is the lower bound and the second item is the upper bound.',
'When `operation`, is set to one of the set value',
'(' + constants.SET_OPS + ')',
'*value* is expected to be an array with as many items as',
'the desired set elements.'
].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: scatterLineAttrs.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}) },
{ colorbar: colorbarAttrs }
);