-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathlayout_attributes.js
105 lines (88 loc) · 3.09 KB
/
layout_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
'use strict';
var colorAttrs = require('../../components/color/attributes');
var axesAttrs = require('../cartesian/layout_attributes');
var domainAttrs = require('../domain').attributes;
var extendFlat = require('../../lib').extendFlat;
var overrideAll = require('../../plot_api/edit_types').overrideAll;
var axisLineGridAttr = overrideAll({
color: axesAttrs.color,
showline: extendFlat({}, axesAttrs.showline, {dflt: true}),
linecolor: axesAttrs.linecolor,
linewidth: axesAttrs.linewidth,
showgrid: extendFlat({}, axesAttrs.showgrid, {dflt: true}),
gridcolor: axesAttrs.gridcolor,
gridwidth: axesAttrs.gridwidth,
griddash: axesAttrs.griddash
}, 'plot', 'from-root');
var axisTickAttrs = overrideAll({
ticklen: axesAttrs.ticklen,
tickwidth: extendFlat({}, axesAttrs.tickwidth, {dflt: 2}),
tickcolor: axesAttrs.tickcolor,
showticklabels: axesAttrs.showticklabels,
labelalias: axesAttrs.labelalias,
showtickprefix: axesAttrs.showtickprefix,
tickprefix: axesAttrs.tickprefix,
showticksuffix: axesAttrs.showticksuffix,
ticksuffix: axesAttrs.ticksuffix,
tickfont: axesAttrs.tickfont,
tickformat: axesAttrs.tickformat,
hoverformat: axesAttrs.hoverformat,
layer: axesAttrs.layer
}, 'plot', 'from-root');
var realAxisAttrs = extendFlat({
visible: extendFlat({}, axesAttrs.visible, {dflt: true}),
tickvals: {
dflt: [0.2, 0.5, 1, 2, 5],
valType: 'data_array',
editType: 'plot',
description: 'Sets the values at which ticks on this axis appear.'
},
tickangle: extendFlat({}, axesAttrs.tickangle, {dflt: 90}),
ticks: {
valType: 'enumerated',
values: ['top', 'bottom', ''],
editType: 'ticks',
description: [
'Determines whether ticks are drawn or not.',
'If **, this axis\' ticks are not drawn.',
'If *top* (*bottom*), this axis\' are drawn above (below)',
'the axis line.'
].join(' ')
},
side: {
valType: 'enumerated',
values: ['top', 'bottom'],
dflt: 'top',
editType: 'plot',
description: [
'Determines on which side of real axis line',
'the tick and tick labels appear.'
].join(' ')
},
editType: 'calc',
}, axisLineGridAttr, axisTickAttrs);
var imaginaryAxisAttrs = extendFlat({
visible: extendFlat({}, axesAttrs.visible, {dflt: true}),
tickvals: {
valType: 'data_array',
editType: 'plot',
description: [
'Sets the values at which ticks on this axis appear.',
'Defaults to `realaxis.tickvals` plus the same as negatives and zero.'
].join(' ')
},
ticks: axesAttrs.ticks,
editType: 'calc'
}, axisLineGridAttr, axisTickAttrs);
module.exports = {
domain: domainAttrs({name: 'smith', editType: 'plot'}),
bgcolor: {
valType: 'color',
editType: 'plot',
dflt: colorAttrs.background,
description: 'Set the background color of the subplot'
},
realaxis: realAxisAttrs,
imaginaryaxis: imaginaryAxisAttrs,
editType: 'calc'
};