-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathattributes.js
144 lines (126 loc) · 4.09 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
/**
* Copyright 2012-2018, 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 scatterGlAttrs = require('../scattergl/attributes');
var cartesianIdRegex = require('../../plots/cartesian/constants').idRegex;
var templatedArray = require('../../plot_api/plot_template').templatedArray;
function makeAxesValObject(axLetter) {
return {
valType: 'info_array',
freeLength: true,
role: 'info',
editType: 'calc',
items: {
valType: 'subplotid',
regex: cartesianIdRegex[axLetter],
editType: 'plot'
},
description: [
'Sets the list of ' + axLetter + ' axes',
'corresponding to this splom trace.',
'By default, a splom will match the first N ' + axLetter + 'axes',
'where N is the number of input dimensions.'
].join(' ')
};
}
module.exports = {
dimensions: templatedArray('dimension', {
visible: {
valType: 'boolean',
role: 'info',
dflt: true,
editType: 'calc',
description: [
'Determines whether or not this dimension is shown on the graph.',
'Note that even visible false dimension contribute to the',
'default grid generate by this splom trace.'
].join(' ')
},
label: {
valType: 'string',
role: 'info',
editType: 'calc',
description: 'Sets the label corresponding to this splom dimension.'
},
values: {
valType: 'data_array',
role: 'info',
editType: 'calc+clearAxisTypes',
description: 'Sets the dimension values to be plotted.'
},
axis: {
type: {
valType: 'enumerated',
values: ['linear', 'log', 'date', 'category'],
role: 'info',
editType: 'calc+clearAxisTypes',
description: [
'Sets the axis type for this dimension\'s generated',
'x and y axes.',
'Note that the axis `type` values set in layout take',
'precedence over this attribute.'
].join(' ')
},
editType: 'calc+clearAxisTypes'
},
// TODO should add an attribute to pin down x only vars and y only vars
// like https://seaborn.pydata.org/generated/seaborn.pairplot.html
// x_vars and y_vars
// maybe more axis defaulting option e.g. `showgrid: false`
editType: 'calc+clearAxisTypes'
}),
// mode: {}, (only 'markers' for now)
text: scatterGlAttrs.text,
marker: scatterGlAttrs.marker,
xaxes: makeAxesValObject('x'),
yaxes: makeAxesValObject('y'),
diagonal: {
visible: {
valType: 'boolean',
role: 'info',
dflt: true,
editType: 'calc',
description: [
'Determines whether or not subplots on the diagonal are displayed.'
].join(' ')
},
// type: 'scattergl' | 'histogram' | 'box' | 'violin'
// ...
// more options
editType: 'calc'
},
showupperhalf: {
valType: 'boolean',
role: 'info',
dflt: true,
editType: 'calc',
description: [
'Determines whether or not subplots on the upper half',
'from the diagonal are displayed.'
].join(' ')
},
showlowerhalf: {
valType: 'boolean',
role: 'info',
dflt: true,
editType: 'calc',
description: [
'Determines whether or not subplots on the lower half',
'from the diagonal are displayed.'
].join(' ')
},
selected: {
marker: scatterGlAttrs.selected.marker,
editType: 'calc'
},
unselected: {
marker: scatterGlAttrs.unselected.marker,
editType: 'calc'
},
opacity: scatterGlAttrs.opacity
};