-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathaxis_attributes.js
149 lines (140 loc) · 4.25 KB
/
axis_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
/**
* 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('../../cartesian/layout_attributes');
var extendFlat = require('../../../lib/extend').extendFlat;
var overrideAll = require('../../../plot_api/edit_types').overrideAll;
var domainAttr = extendFlat({}, axesAttrs.domain, {
description: [
'Polar chart subplots are not supported yet.',
'This key has currently no effect.'
].join(' ')
});
function mergeAttrs(axisName, nonCommonAttrs) {
var commonAttrs = {
showline: {
valType: 'boolean',
role: 'style',
description: [
'Determines whether or not the line bounding this',
axisName, 'axis',
'will be shown on the figure.'
].join(' ')
},
showticklabels: {
valType: 'boolean',
role: 'style',
description: [
'Determines whether or not the',
axisName, 'axis ticks',
'will feature tick labels.'
].join(' ')
},
tickorientation: {
valType: 'enumerated',
values: ['horizontal', 'vertical'],
role: 'style',
description: [
'Sets the orientation (from the paper perspective)',
'of the', axisName, 'axis tick labels.'
].join(' ')
},
ticklen: {
valType: 'number',
min: 0,
role: 'style',
description: [
'Sets the length of the tick lines on this', axisName, 'axis.'
].join(' ')
},
tickcolor: {
valType: 'color',
role: 'style',
description: [
'Sets the color of the tick lines on this', axisName, 'axis.'
].join(' ')
},
ticksuffix: {
valType: 'string',
role: 'style',
description: [
'Sets the length of the tick lines on this', axisName, 'axis.'
].join(' ')
},
endpadding: {
valType: 'number',
role: 'style'
},
visible: {
valType: 'boolean',
role: 'info',
description: [
'Determines whether or not this axis will be visible.'
].join(' ')
}
};
return extendFlat({}, nonCommonAttrs, commonAttrs);
}
module.exports = overrideAll({
radialaxis: mergeAttrs('radial', {
range: {
valType: 'info_array',
role: 'info',
items: [
{ valType: 'number' },
{ valType: 'number' }
],
description: [
'Defines the start and end point of this radial axis.'
].join(' ')
},
domain: domainAttr,
orientation: {
valType: 'number',
role: 'style',
description: [
'Sets the orientation (an angle with respect to the origin)',
'of the radial axis.'
].join(' ')
}
}),
angularaxis: mergeAttrs('angular', {
range: {
valType: 'info_array',
role: 'info',
items: [
{ valType: 'number', dflt: 0 },
{ valType: 'number', dflt: 360 }
],
description: [
'Defines the start and end point of this angular axis.'
].join(' ')
},
domain: domainAttr
}),
// attributes that appear at layout root
layout: {
direction: {
valType: 'enumerated',
values: ['clockwise', 'counterclockwise'],
role: 'info',
description: [
'For polar plots only.',
'Sets the direction corresponding to positive angles.'
].join(' ')
},
orientation: {
valType: 'angle',
role: 'info',
description: [
'For polar plots only.',
'Rotates the entire polar by the given angle.'
].join(' ')
}
}
}, 'plot', 'nested');