-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathattributes.js
247 lines (242 loc) · 8.96 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
'use strict';
var fontAttrs = require('./font_attributes');
var fxAttrs = require('../components/fx/attributes');
module.exports = {
type: {
valType: 'enumerated',
values: [], // listed dynamically
dflt: 'scatter',
editType: 'calc+clearAxisTypes',
_noTemplating: true // we handle this at a higher level
},
visible: {
valType: 'enumerated',
values: [true, false, 'legendonly'],
dflt: true,
editType: 'calc',
description: [
'Determines whether or not this trace is visible.',
'If *legendonly*, the trace is not drawn,',
'but can appear as a legend item',
'(provided that the legend itself is visible).'
].join(' ')
},
showlegend: {
valType: 'boolean',
dflt: true,
editType: 'style',
description: [
'Determines whether or not an item corresponding to this',
'trace is shown in the legend.'
].join(' ')
},
legend: {
valType: 'subplotid',
dflt: 'legend',
editType: 'style',
description: [
'Sets the reference to a legend to show this trace in.',
'References to these legends are *legend*, *legend2*, *legend3*, etc.',
'Settings for these legends are set in the layout, under',
'`layout.legend`, `layout.legend2`, etc.'
].join(' ')
},
legendgroup: {
valType: 'string',
dflt: '',
editType: 'style',
description: [
'Sets the legend group for this trace.',
'Traces and shapes part of the same legend group hide/show at the same time',
'when toggling legend items.'
].join(' ')
},
legendgrouptitle: {
text: {
valType: 'string',
dflt: '',
editType: 'style',
description: [
'Sets the title of the legend group.'
].join(' ')
},
font: fontAttrs({
editType: 'style',
description: [
'Sets this legend group\'s title font.'
].join(' '),
}),
editType: 'style',
},
legendrank: {
valType: 'number',
dflt: 1000,
editType: 'style',
description: [
'Sets the legend rank for this trace.',
'Items and groups with smaller ranks are presented on top/left side while',
'with *reversed* `legend.traceorder` they are on bottom/right side.',
'The default legendrank is 1000,',
'so that you can use ranks less than 1000 to place certain items before all unranked items,',
'and ranks greater than 1000 to go after all unranked items.',
'When having unranked or equal rank items shapes would be displayed after traces',
'i.e. according to their order in data and layout.'
].join(' ')
},
legendwidth: {
valType: 'number',
min: 0,
editType: 'style',
description: 'Sets the width (in px or fraction) of the legend for this trace.',
},
opacity: {
valType: 'number',
min: 0,
max: 1,
dflt: 1,
editType: 'style',
description: 'Sets the opacity of the trace.'
},
name: {
valType: 'string',
editType: 'style',
description: [
'Sets the trace name.',
'The trace name appears as the legend item and on hover.'
].join(' ')
},
uid: {
valType: 'string',
editType: 'plot',
anim: true,
description: [
'Assign an id to this trace,',
'Use this to provide object constancy between traces during animations',
'and transitions.'
].join(' ')
},
ids: {
valType: 'data_array',
editType: 'calc',
anim: true,
description: [
'Assigns id labels to each datum.',
'These ids for object constancy of data points during animation.',
'Should be an array of strings, not numbers or any other type.'
].join(' ')
},
customdata: {
valType: 'data_array',
editType: 'calc',
description: [
'Assigns extra data each datum.',
'This may be useful when listening to hover, click and selection events.',
'Note that, *scatter* traces also appends customdata items in the markers',
'DOM elements'
].join(' ')
},
meta: {
valType: 'any',
arrayOk: true,
editType: 'plot',
description: [
'Assigns extra meta information associated with this trace',
'that can be used in various text attributes.',
'Attributes such as trace `name`, graph, axis and colorbar `title.text`, annotation `text`',
'`rangeselector`, `updatemenues` and `sliders` `label` text',
'all support `meta`.',
'To access the trace `meta` values in an attribute in the same trace, simply use',
'`%{meta[i]}` where `i` is the index or key of the `meta`',
'item in question.',
'To access trace `meta` in layout attributes, use',
'`%{data[n[.meta[i]}` where `i` is the index or key of the `meta`',
'and `n` is the trace index.'
].join(' ')
},
// N.B. these cannot be 'data_array' as they do not have the same length as
// other data arrays and arrayOk attributes in general
//
// Maybe add another valType:
// https://github.com/plotly/plotly.js/issues/1894
selectedpoints: {
valType: 'any',
editType: 'calc',
description: [
'Array containing integer indices of selected points.',
'Has an effect only for traces that support selections.',
'Note that an empty array means an empty selection where the `unselected`',
'are turned on for all points, whereas, any other non-array values means no',
'selection all where the `selected` and `unselected` styles have no effect.'
].join(' ')
},
hoverinfo: {
valType: 'flaglist',
flags: ['x', 'y', 'z', 'text', 'name'],
extras: ['all', 'none', 'skip'],
arrayOk: true,
dflt: 'all',
editType: 'none',
description: [
'Determines which trace information appear on hover.',
'If `none` or `skip` are set, no information is displayed upon hovering.',
'But, if `none` is set, click and hover events are still fired.'
].join(' ')
},
hoverlabel: fxAttrs.hoverlabel,
stream: {
token: {
valType: 'string',
noBlank: true,
strict: true,
editType: 'calc',
description: [
'The stream id number links a data trace on a plot with a stream.',
'See https://chart-studio.plotly.com/settings for more details.'
].join(' ')
},
maxpoints: {
valType: 'number',
min: 0,
max: 10000,
dflt: 500,
editType: 'calc',
description: [
'Sets the maximum number of points to keep on the plots from an',
'incoming stream.',
'If `maxpoints` is set to *50*, only the newest 50 points will',
'be displayed on the plot.'
].join(' ')
},
editType: 'calc'
},
transforms: {
_isLinkedToArray: 'transform',
editType: 'calc',
description: [
'WARNING: All transforms are deprecated and may be removed from the API in next major version.',
'An array of operations that manipulate the trace data,',
'for example filtering or sorting the data arrays.'
].join(' ')
},
uirevision: {
valType: 'any',
editType: 'none',
description: [
'Controls persistence of some user-driven changes to the trace:',
'`constraintrange` in `parcoords` traces, as well as some',
'`editable: true` modifications such as `name` and `colorbar.title`.',
'Defaults to `layout.uirevision`.',
'Note that other user-driven trace attribute changes are controlled',
'by `layout` attributes:',
'`trace.visible` is controlled by `layout.legend.uirevision`,',
'`selectedpoints` is controlled by `layout.selectionrevision`,',
'and `colorbar.(x|y)` (accessible with `config: {editable: true}`)',
'is controlled by `layout.editrevision`.',
'Trace changes are tracked by `uid`, which only falls back on trace',
'index if no `uid` is provided. So if your app can add/remove traces',
'before the end of the `data` array, such that the same trace has a',
'different index, you can still preserve user-driven changes if you',
'give each trace a `uid` that stays with it as it moves.'
].join(' ')
}
};