forked from plotly/plotly.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathattributes.js
195 lines (191 loc) · 5.9 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
/**
* 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 axesAttrs = require('../../plots/cartesian/layout_attributes');
var fontAttrs = require('../../plots/font_attributes');
var extendFlat = require('../../lib/extend').extendFlat;
module.exports = {
// TODO: only right is supported currently
// orient: {
// valType: 'enumerated',
// role: 'info',
// values: ['left', 'right', 'top', 'bottom'],
// dflt: 'right',
// description: [
// 'Determines which side are the labels on',
// '(so left and right make vertical bars, etc.)'
// ].join(' ')
// },
thicknessmode: {
valType: 'enumerated',
values: ['fraction', 'pixels'],
role: 'style',
dflt: 'pixels',
description: [
'Determines whether this color bar\'s thickness',
'(i.e. the measure in the constant color direction)',
'is set in units of plot *fraction* or in *pixels*.',
'Use `thickness` to set the value.'
].join(' ')
},
thickness: {
valType: 'number',
role: 'style',
min: 0,
dflt: 30,
description: [
'Sets the thickness of the color bar',
'This measure excludes the size of the padding, ticks and labels.'
].join(' ')
},
lenmode: {
valType: 'enumerated',
values: ['fraction', 'pixels'],
role: 'info',
dflt: 'fraction',
description: [
'Determines whether this color bar\'s length',
'(i.e. the measure in the color variation direction)',
'is set in units of plot *fraction* or in *pixels.',
'Use `len` to set the value.'
].join(' ')
},
len: {
valType: 'number',
min: 0,
dflt: 1,
role: 'style',
description: [
'Sets the length of the color bar',
'This measure excludes the padding of both ends.',
'That is, the color bar length is this length minus the',
'padding on both ends.'
].join(' ')
},
x: {
valType: 'number',
dflt: 1.02,
min: -2,
max: 3,
role: 'style',
description: [
'Sets the x position of the color bar (in plot fraction).'
].join(' ')
},
xanchor: {
valType: 'enumerated',
values: ['left', 'center', 'right'],
dflt: 'left',
role: 'style',
description: [
'Sets this color bar\'s horizontal position anchor.',
'This anchor binds the `x` position to the *left*, *center*',
'or *right* of the color bar.'
].join(' ')
},
xpad: {
valType: 'number',
role: 'style',
min: 0,
dflt: 10,
description: 'Sets the amount of padding (in px) along the x direction.'
},
y: {
valType: 'number',
role: 'style',
dflt: 0.5,
min: -2,
max: 3,
description: [
'Sets the y position of the color bar (in plot fraction).'
].join(' ')
},
yanchor: {
valType: 'enumerated',
values: ['top', 'middle', 'bottom'],
role: 'style',
dflt: 'middle',
description: [
'Sets this color bar\'s vertical position anchor',
'This anchor binds the `y` position to the *top*, *middle*',
'or *bottom* of the color bar.'
].join(' ')
},
ypad: {
valType: 'number',
role: 'style',
min: 0,
dflt: 10,
description: 'Sets the amount of padding (in px) along the y direction.'
},
// a possible line around the bar itself
outlinecolor: axesAttrs.linecolor,
outlinewidth: axesAttrs.linewidth,
// Should outlinewidth have {dflt: 0} ?
// another possible line outside the padding and tick labels
bordercolor: axesAttrs.linecolor,
borderwidth: {
valType: 'number',
role: 'style',
min: 0,
dflt: 0,
description: [
'Sets the width (in px) or the border enclosing this color bar.'
].join(' ')
},
bgcolor: {
valType: 'color',
role: 'style',
dflt: 'rgba(0,0,0,0)',
description: 'Sets the color of padded area.'
},
// tick and title properties named and function exactly as in axes
tickmode: axesAttrs.tickmode,
nticks: axesAttrs.nticks,
tick0: axesAttrs.tick0,
dtick: axesAttrs.dtick,
tickvals: axesAttrs.tickvals,
ticktext: axesAttrs.ticktext,
ticks: extendFlat({}, axesAttrs.ticks, {dflt: ''}),
ticklen: axesAttrs.ticklen,
tickwidth: axesAttrs.tickwidth,
tickcolor: axesAttrs.tickcolor,
showticklabels: axesAttrs.showticklabels,
tickfont: axesAttrs.tickfont,
tickangle: axesAttrs.tickangle,
tickformat: axesAttrs.tickformat,
tickformatstops: axesAttrs.tickformatstops,
tickprefix: axesAttrs.tickprefix,
showtickprefix: axesAttrs.showtickprefix,
ticksuffix: axesAttrs.ticksuffix,
showticksuffix: axesAttrs.showticksuffix,
separatethousands: axesAttrs.separatethousands,
exponentformat: axesAttrs.exponentformat,
showexponent: axesAttrs.showexponent,
title: {
valType: 'string',
role: 'info',
dflt: 'Click to enter colorscale title',
description: 'Sets the title of the color bar.'
},
titlefont: extendFlat({}, fontAttrs, {
description: [
'Sets this color bar\'s title font.'
].join(' ')
}),
titleside: {
valType: 'enumerated',
values: ['right', 'top', 'bottom'],
role: 'style',
dflt: 'top',
description: [
'Determines the location of the colorbar title',
'with respect to the color bar.'
].join(' ')
}
};