-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathattributes.js
141 lines (127 loc) · 4.2 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
/**
* Copyright 2012-2019, 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 pieAtts = require('../pie/attributes');
var barAttrs = require('../bar/attributes');
var lineAttrs = require('../scatter/attributes').line;
var extendFlat = require('../../lib/extend').extendFlat;
var Color = require('../../components/color');
function directionAttrs(dirTxt) {
return {
marker: {
color: extendFlat({}, barAttrs.marker.color, {
arrayOk: false,
editType: 'style',
description: 'Sets the marker color of all ' + dirTxt + ' values.'
}),
line: {
color: extendFlat({}, barAttrs.marker.line.color, {
arrayOk: false,
editType: 'style',
description: 'Sets the line color of all ' + dirTxt + ' values.'
}),
width: extendFlat({}, barAttrs.marker.line.width, {
arrayOk: false,
editType: 'style',
description: 'Sets the line width of all ' + dirTxt + ' values.'
}),
editType: 'style',
},
editType: 'style'
},
editType: 'style'
};
}
module.exports = {
measure: {
valType: 'data_array',
dflt: [],
role: 'info',
editType: 'calc',
description: [
'An array containing types of values.',
'By default the values are considered as \'relative\'.',
'However; it is possible to use \'total\' to compute the sums.',
'Also \'absolute\' could be applied to reset the computed total',
'or to declare an initial value where needed.'
].join(' ')
},
base: {
valType: 'number',
dflt: null,
arrayOk: false,
role: 'info',
editType: 'calc',
description: [
'Sets where the bar base is drawn (in position axis units).'
].join(' ')
},
x: barAttrs.x,
x0: barAttrs.x0,
dx: barAttrs.dx,
y: barAttrs.y,
y0: barAttrs.y0,
dy: barAttrs.dy,
hovertext: barAttrs.hovertext,
hovertemplate: barAttrs.hovertemplate,
textinfo: extendFlat({}, pieAtts.textinfo, {
editType: 'plot',
flags: ['label', 'text', 'initial', 'delta', 'final'],
arrayOk: false,
description: [
'Determines which trace information appear on the graph.'
].join(' ')
}),
text: barAttrs.text,
textposition: barAttrs.textposition,
insidetextanchor: barAttrs.insidetextanchor,
textangle: barAttrs.textangle,
textfont: barAttrs.textfont,
insidetextfont: barAttrs.insidetextfont,
outsidetextfont: barAttrs.outsidetextfont,
constraintext: barAttrs.constraintext,
cliponaxis: barAttrs.cliponaxis,
orientation: barAttrs.orientation,
offset: barAttrs.offset,
width: barAttrs.width,
increasing: directionAttrs('increasing'),
decreasing: directionAttrs('decreasing'),
totals: directionAttrs('intermediate sums and total'),
connector: {
line: {
color: extendFlat({}, lineAttrs.color, {dflt: Color.defaultLine}),
width: extendFlat({}, lineAttrs.width, {
editType: 'plot', // i.e. to adjust bars is mode: 'between'. See https://github.com/plotly/plotly.js/issues/3787
}),
dash: lineAttrs.dash,
editType: 'plot'
},
mode: {
valType: 'enumerated',
values: ['spanning', 'between'],
dflt: 'between',
role: 'info',
editType: 'plot',
description: [
'Sets the shape of connector lines.'
].join(' ')
},
visible: {
valType: 'boolean',
dflt: true,
role: 'info',
editType: 'plot',
description: [
'Determines if connector lines are drawn. '
].join(' ')
},
editType: 'plot'
},
offsetgroup: barAttrs.offsetgroup,
alignmentgroup: barAttrs.offsetgroup
};