-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathattributes.js
151 lines (138 loc) · 4.67 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
'use strict';
var colorScaleAttrs = require('../../components/colorscale/attributes');
var axisHoverFormat = require('../../plots/cartesian/axis_format_attributes').axisHoverFormat;
var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs;
var meshAttrs = require('../mesh3d/attributes');
var baseAttrs = require('../../plots/attributes');
var extendFlat = require('../../lib/extend').extendFlat;
var overrideAll = require('../../plot_api/edit_types').overrideAll;
var attrs = module.exports = overrideAll(extendFlat({
x: {
valType: 'data_array',
description: [
'Sets the X coordinates of bars on X axis.'
].join(' ')
},
y: {
valType: 'data_array',
description: [
'Sets the Y coordinates of bars on Y axis.'
].join(' ')
},
base: {
valType: 'data_array',
description: [
'Sets the Z coordinates (i.e. the base) of bars on Z axis.'
].join(' ')
},
value: {
valType: 'data_array',
description: [
'Sets the height of bars.'
].join(' ')
},
showbase: {
valType: 'boolean',
dflt: false,
editType: 'calc',
description: [
'Determines whether or not the base of a bar is filled.'
].join(' ')
},
xgap: {
valType: 'number',
min: 0,
max: 1,
dflt: 0.2,
editType: 'calc',
description: [
'Sets the gap (in plot fraction) between bars of',
'adjacent location coordinates on X axis.'
].join(' ')
},
ygap: {
valType: 'number',
min: 0,
max: 1,
dflt: 0.2,
editType: 'calc',
description: [
'Sets the gap (in plot fraction) between bars of',
'adjacent location coordinates on Y axis.'
].join(' ')
},
marker: {
color: {
valType: 'color',
dflt: '#eee', // TODO: Is this a good default?
// TODO: support arrayOk
editType: 'calc',
description: [
'Sets the color of the whole mesh if `coloring` is set to *color*.'
].join(' ')
},
coloring: {
valType: 'enumerated',
values: ['color', 'fill', 'heatmap'],
dflt: 'heatmap',
editType: 'calc',
description: [
'Determines the coloring method showing the bar values.',
'If *color*, *marker.color* is used for all bars.',
'If *fill*, coloring is done evenly across a single bar.',
'If *heatmap*, a heatmap gradient coloring is applied',
'between each level from bottom to top.'
].join(' ')
},
fill: {
valType: 'number',
min: 0,
max: 1,
dflt: 1,
description: [
'Sets the fill ratio of the `marker` elements. The default fill value',
'is 0.15 meaning that only 15% of the area of every faces of tetras would be',
'shaded. Applying a greater `fill` ratio would allow the creation of stronger',
'elements or could be sued to have entirely closed areas (in case of using 1).'
].join(' ')
},
},
text: {
valType: 'string',
dflt: '',
arrayOk: true,
description: [
'Sets the text elements associated with the vertices.',
'If trace `hoverinfo` contains a *text* flag and *hovertext* is not set,',
'these elements will be seen in the hover labels.'
].join(' ')
},
hovertext: {
valType: 'string',
dflt: '',
arrayOk: true,
description: 'Same as `text`.'
},
hovertemplate: hovertemplateAttrs(),
xhoverformat: axisHoverFormat('x'),
yhoverformat: axisHoverFormat('y'),
zhoverformat: axisHoverFormat('z'),
valuehoverformat: axisHoverFormat('value', 1),
showlegend: extendFlat({}, baseAttrs.showlegend, {dflt: false})
},
colorScaleAttrs('', {
colorAttr: '`value`',
showScaleDflt: true,
editTypeOverride: 'calc'
}), {
opacity: meshAttrs.opacity,
lightposition: meshAttrs.lightposition,
lighting: meshAttrs.lighting,
flatshading: meshAttrs.flatshading,
contour: meshAttrs.contour,
hoverinfo: extendFlat({}, baseAttrs.hoverinfo)
}), 'calc', 'nested');
// required defaults to speed up surface normal calculations
attrs.flatshading.dflt = true; attrs.lighting.facenormalsepsilon.dflt = 0;
attrs.x.editType = attrs.y.editType = attrs.base.editType = attrs.value.editType = 'calc+clearAxisTypes';
attrs.transforms = undefined;