forked from plotly/plotly.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathattributes.js
292 lines (283 loc) · 10.3 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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
'use strict';
var fontAttrs = require('../../plots/font_attributes');
var colorAttrs = require('../color/attributes');
module.exports = {
// not really a 'subplot' attribute container,
// but this is the flag we use to denote attributes that
// support yaxis, yaxis2, yaxis3, ... counters
_isSubplotObj: true,
visible: {
valType: 'boolean',
dflt: true,
editType: 'legend',
description: [
'Determines whether or not this legend is visible.'
].join(' ')
},
bgcolor: {
valType: 'color',
editType: 'legend',
description: [
'Sets the legend background color.',
'Defaults to `layout.paper_bgcolor`.'
].join(' ')
},
bordercolor: {
valType: 'color',
dflt: colorAttrs.defaultLine,
editType: 'legend',
description: 'Sets the color of the border enclosing the legend.'
},
borderwidth: {
valType: 'number',
min: 0,
dflt: 0,
editType: 'legend',
description: 'Sets the width (in px) of the border enclosing the legend.'
},
font: fontAttrs({
editType: 'legend',
description: 'Sets the font used to text the legend items.'
}),
grouptitlefont: fontAttrs({
editType: 'legend',
description: [
'Sets the font for group titles in legend.',
'Defaults to `legend.font` with its size increased about 10%.'
].join(' ')
}),
orientation: {
valType: 'enumerated',
values: ['v', 'h'],
dflt: 'v',
editType: 'legend',
description: 'Sets the orientation of the legend.'
},
traceorder: {
valType: 'flaglist',
flags: ['reversed', 'grouped'],
extras: ['normal'],
editType: 'legend',
description: [
'Determines the order at which the legend items are displayed.',
'If *normal*, the items are displayed top-to-bottom in the same',
'order as the input data.',
'If *reversed*, the items are displayed in the opposite order',
'as *normal*.',
'If *grouped*, the items are displayed in groups',
'(when a trace `legendgroup` is provided).',
'if *grouped+reversed*, the items are displayed in the opposite order',
'as *grouped*.'
].join(' ')
},
tracegroupgap: {
valType: 'number',
min: 0,
dflt: 10,
editType: 'legend',
description: [
'Sets the amount of vertical space (in px) between legend groups.'
].join(' ')
},
entrywidth: {
valType: 'number',
min: 0,
editType: 'legend',
description: [
'Sets the width (in px or fraction) of the legend.',
'Use 0 to size the entry based on the text width,',
'when `entrywidthmode` is set to *pixels*.'
].join(' ')
},
entrywidthmode: {
valType: 'enumerated',
values: ['fraction', 'pixels'],
dflt: 'pixels',
editType: 'legend',
description: 'Determines what entrywidth means.',
},
indentation: {
valType: 'number',
min: -15,
dflt: 0,
editType: 'legend',
description: 'Sets the indentation (in px) of the legend entries.',
},
itemsizing: {
valType: 'enumerated',
values: ['trace', 'constant'],
dflt: 'trace',
editType: 'legend',
description: [
'Determines if the legend items symbols scale with their corresponding *trace* attributes',
'or remain *constant* independent of the symbol size on the graph.'
].join(' ')
},
itemwidth: {
valType: 'number',
min: 30,
dflt: 30,
editType: 'legend',
description: 'Sets the width (in px) of the legend item symbols (the part other than the title.text).',
},
itemclick: {
valType: 'enumerated',
values: ['toggle', 'toggleothers', false],
dflt: 'toggle',
editType: 'legend',
description: [
'Determines the behavior on legend item click.',
'*toggle* toggles the visibility of the item clicked on the graph.',
'*toggleothers* makes the clicked item the sole visible item on the graph.',
'*false* disables legend item click interactions.'
].join(' ')
},
itemdoubleclick: {
valType: 'enumerated',
values: ['toggle', 'toggleothers', false],
dflt: 'toggleothers',
editType: 'legend',
description: [
'Determines the behavior on legend item double-click.',
'*toggle* toggles the visibility of the item clicked on the graph.',
'*toggleothers* makes the clicked item the sole visible item on the graph.',
'*false* disables legend item double-click interactions.'
].join(' ')
},
groupclick: {
valType: 'enumerated',
values: ['toggleitem', 'togglegroup'],
dflt: 'togglegroup',
editType: 'legend',
description: [
'Determines the behavior on legend group item click.',
'*toggleitem* toggles the visibility of the individual item clicked on the graph.',
'*togglegroup* toggles the visibility of all items in the same legendgroup as the item clicked on the graph.'
].join(' ')
},
x: {
valType: 'number',
editType: 'legend',
description: [
'Sets the x position with respect to `xref` (in normalized coordinates) of the legend.',
'When `xref` is *paper*, defaults to *1.02* for vertical legends and',
'defaults to *0* for horizontal legends.',
'When `xref` is *container*, defaults to *1* for vertical legends and',
'defaults to *0* for horizontal legends.',
'Must be between *0* and *1* if `xref` is *container*.',
'and between *-2* and *3* if `xref` is *paper*.'
].join(' ')
},
xref: {
valType: 'enumerated',
dflt: 'paper',
values: ['container', 'paper'],
editType: 'layoutstyle',
description: [
'Sets the container `x` refers to.',
'*container* spans the entire `width` of the plot.',
'*paper* refers to the width of the plotting area only.'
].join(' ')
},
xanchor: {
valType: 'enumerated',
values: ['auto', 'left', 'center', 'right'],
dflt: 'left',
editType: 'legend',
description: [
'Sets the legend\'s horizontal position anchor.',
'This anchor binds the `x` position to the *left*, *center*',
'or *right* of the legend.',
'Value *auto* anchors legends to the right for `x` values greater than or equal to 2/3,',
'anchors legends to the left for `x` values less than or equal to 1/3 and',
'anchors legends with respect to their center otherwise.'
].join(' ')
},
y: {
valType: 'number',
editType: 'legend',
description: [
'Sets the y position with respect to `yref` (in normalized coordinates) of the legend.',
'When `yref` is *paper*, defaults to *1* for vertical legends,',
'defaults to *-0.1* for horizontal legends on graphs w/o range sliders and',
'defaults to *1.1* for horizontal legends on graph with one or multiple range sliders.',
'When `yref` is *container*, defaults to *1*.',
'Must be between *0* and *1* if `yref` is *container*',
'and between *-2* and *3* if `yref` is *paper*.'
].join(' ')
},
yref: {
valType: 'enumerated',
dflt: 'paper',
values: ['container', 'paper'],
editType: 'layoutstyle',
description: [
'Sets the container `y` refers to.',
'*container* spans the entire `height` of the plot.',
'*paper* refers to the height of the plotting area only.'
].join(' ')
},
yanchor: {
valType: 'enumerated',
values: ['auto', 'top', 'middle', 'bottom'],
editType: 'legend',
description: [
'Sets the legend\'s vertical position anchor',
'This anchor binds the `y` position to the *top*, *middle*',
'or *bottom* of the legend.',
'Value *auto* anchors legends at their bottom for `y` values less than or equal to 1/3,',
'anchors legends to at their top for `y` values greater than or equal to 2/3 and',
'anchors legends with respect to their middle otherwise.'
].join(' ')
},
uirevision: {
valType: 'any',
editType: 'none',
description: [
'Controls persistence of legend-driven changes in trace and pie label',
'visibility. Defaults to `layout.uirevision`.'
].join(' ')
},
valign: {
valType: 'enumerated',
values: ['top', 'middle', 'bottom'],
dflt: 'middle',
editType: 'legend',
description: [
'Sets the vertical alignment of the symbols with respect to their associated text.',
].join(' ')
},
title: {
text: {
valType: 'string',
dflt: '',
editType: 'legend',
description: [
'Sets the title of the legend.'
].join(' ')
},
font: fontAttrs({
editType: 'legend',
description: [
'Sets this legend\'s title font.',
'Defaults to `legend.font` with its size increased about 20%.'
].join(' '),
}),
side: {
valType: 'enumerated',
values: ['top', 'left', 'top left', 'top center', 'top right'],
editType: 'legend',
description: [
'Determines the location of legend\'s title',
'with respect to the legend items.',
'Defaulted to *top* with `orientation` is *h*.',
'Defaulted to *left* with `orientation` is *v*.',
'The *top left* options could be used to expand',
'top center and top right are for horizontal alignment',
'legend area in both x and y sides.'
].join(' ')
},
editType: 'legend',
},
editType: 'legend'
};