Skip to content

Commit 853581e

Browse files
committed
introduce scatterpolar attributes
1 parent 58d53e8 commit 853581e

File tree

1 file changed

+98
-0
lines changed

1 file changed

+98
-0
lines changed

src/traces/scatterpolar/attributes.js

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/**
2+
* Copyright 2012-2017, Plotly, Inc.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the MIT license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
'use strict';
10+
11+
var extendFlat = require('../../lib/extend').extendFlat;
12+
var scatterAttrs = require('../scatter/attributes');
13+
var plotAttrs = require('../../plots/attributes');
14+
var lineAttrs = scatterAttrs.line;
15+
16+
module.exports = {
17+
// TODO is this correct?
18+
// `dflt: 'markers' matches the scattergeo, scattermapbox types,
19+
// scatter, scattergl, scatterternary, scattercarpet use a special 'line' vs 'markers+lines' logic
20+
// while scatter3d has a hard 'markers+lines' default
21+
mode: extendFlat({}, scatterAttrs.mode, {
22+
dflt: 'markers'
23+
}),
24+
25+
r: {
26+
valType: 'data_array',
27+
editType: 'calc+clearAxisTypes',
28+
description: 'Sets the radial coordinates'
29+
},
30+
31+
theta: {
32+
valType: 'data_array',
33+
editType: 'calc+clearAxisTypes',
34+
description: 'Sets the angular coordinates'
35+
},
36+
37+
thetaunit: {
38+
valType: 'enumerated',
39+
values: ['radians', 'degrees', 'gradians'],
40+
dflt: 'degrees',
41+
role: 'info',
42+
editType: 'calc+clearAxisTypes',
43+
description: 'Sets the unit of input *theta* values.'
44+
},
45+
46+
// TODO not sure r0, dr, theta0, dtheta
47+
// would make sense here?
48+
49+
text: scatterAttrs.text,
50+
hovertext: scatterAttrs.hovertext,
51+
52+
line: {
53+
color: lineAttrs.color,
54+
width: lineAttrs.width,
55+
dash: lineAttrs.dash,
56+
shape: extendFlat({}, lineAttrs.shape, {
57+
values: ['linear', 'spline']
58+
}),
59+
smoothing: lineAttrs.smoothing,
60+
editType: 'calc'
61+
},
62+
connectgaps: scatterAttrs.connectgaps,
63+
64+
marker: scatterAttrs.marker,
65+
cliponaxis: scatterAttrs.cliponaxis,
66+
67+
textposition: scatterAttrs.textposition,
68+
textfont: scatterAttrs.textfont,
69+
70+
fill: extendFlat({}, scatterAttrs.fill, {
71+
values: ['none', 'toself', 'tonext'],
72+
description: [
73+
'Sets the area to fill with a solid color.',
74+
'Use with `fillcolor` if not *none*.',
75+
'scatterpolar has a subset of the options available to scatter.',
76+
'*toself* connects the endpoints of the trace (or each segment',
77+
'of the trace if it has gaps) into a closed shape.',
78+
'*tonext* fills the space between two traces if one completely',
79+
'encloses the other (eg consecutive contour lines), and behaves like',
80+
'*toself* if there is no trace before it. *tonext* should not be',
81+
'used if one trace does not enclose the other.'
82+
].join(' ')
83+
}),
84+
fillcolor: scatterAttrs.fillcolor,
85+
86+
// TODO (probably not for first push)
87+
// https://stackoverflow.com/a/26597487/4068492
88+
// error_x (error_r, error_theta)
89+
// error_y
90+
91+
hoverinfo: extendFlat({}, plotAttrs.hoverinfo, {
92+
flags: ['r', 'theta', 'text', 'name']
93+
}),
94+
hoveron: scatterAttrs.hoveron,
95+
96+
selected: scatterAttrs.selected,
97+
unselected: scatterAttrs.unselected
98+
};

0 commit comments

Comments
 (0)