Skip to content

Commit

Permalink
introduce scatterpolar attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
etpinard committed Dec 11, 2017
1 parent 58d53e8 commit 853581e
Showing 1 changed file with 98 additions and 0 deletions.
98 changes: 98 additions & 0 deletions src/traces/scatterpolar/attributes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/**
* 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 extendFlat = require('../../lib/extend').extendFlat;
var scatterAttrs = require('../scatter/attributes');
var plotAttrs = require('../../plots/attributes');
var lineAttrs = scatterAttrs.line;

module.exports = {
// TODO is this correct?
// `dflt: 'markers' matches the scattergeo, scattermapbox types,
// scatter, scattergl, scatterternary, scattercarpet use a special 'line' vs 'markers+lines' logic
// while scatter3d has a hard 'markers+lines' default

This comment has been minimized.

Copy link
@alexcjohnson

alexcjohnson Dec 12, 2017

Collaborator

I would've said to match scatter but don't care too much. Does seem like lines is the most common among the examples we have...

This comment has been minimized.

Copy link
@etpinard

etpinard Jan 4, 2018

Author Contributor

I went with parity with scatter in 1e81039

mode: extendFlat({}, scatterAttrs.mode, {
dflt: 'markers'
}),

r: {
valType: 'data_array',
editType: 'calc+clearAxisTypes',
description: 'Sets the radial coordinates'
},

theta: {

This comment has been minimized.

Copy link
@chriddyp

chriddyp Dec 12, 2017

Member

Maybe θ?

just kidding

valType: 'data_array',
editType: 'calc+clearAxisTypes',
description: 'Sets the angular coordinates'
},

thetaunit: {
valType: 'enumerated',
values: ['radians', 'degrees', 'gradians'],
dflt: 'degrees',
role: 'info',
editType: 'calc+clearAxisTypes',
description: 'Sets the unit of input *theta* values.'

This comment has been minimized.

Copy link
@alexcjohnson

alexcjohnson Dec 12, 2017

Collaborator

should mention that this is only relevant for linear theta axes.

This comment has been minimized.

Copy link
@etpinard

etpinard Jan 4, 2018

Author Contributor

updated in 1e81039

},

// TODO not sure r0, dr, theta0, dtheta
// would make sense here?

This comment has been minimized.

Copy link
@alexcjohnson

alexcjohnson Dec 12, 2017

Collaborator

I can certainly imagine wanting to use theta0 and dtheta at least, then for symmetry why not also do r0 and dr? Dunno if anyone will use them but they're easy enough to include.

This comment has been minimized.

Copy link
@etpinard

etpinard Jan 4, 2018

Author Contributor

I'm going to not add dr, dtheta and friends if not objects. Main reason: I can't think of a default for dtheta.


text: scatterAttrs.text,
hovertext: scatterAttrs.hovertext,

line: {
color: lineAttrs.color,
width: lineAttrs.width,
dash: lineAttrs.dash,
shape: extendFlat({}, lineAttrs.shape, {
values: ['linear', 'spline']
}),
smoothing: lineAttrs.smoothing,
editType: 'calc'
},
connectgaps: scatterAttrs.connectgaps,

marker: scatterAttrs.marker,
cliponaxis: scatterAttrs.cliponaxis,

textposition: scatterAttrs.textposition,
textfont: scatterAttrs.textfont,

fill: extendFlat({}, scatterAttrs.fill, {
values: ['none', 'toself', 'tonext'],
description: [
'Sets the area to fill with a solid color.',
'Use with `fillcolor` if not *none*.',
'scatterpolar has a subset of the options available to scatter.',
'*toself* connects the endpoints of the trace (or each segment',
'of the trace if it has gaps) into a closed shape.',
'*tonext* fills the space between two traces if one completely',
'encloses the other (eg consecutive contour lines), and behaves like',
'*toself* if there is no trace before it. *tonext* should not be',
'used if one trace does not enclose the other.'
].join(' ')
}),
fillcolor: scatterAttrs.fillcolor,

// TODO (probably not for first push)
// https://stackoverflow.com/a/26597487/4068492
// error_x (error_r, error_theta)
// error_y

This comment has been minimized.

Copy link
@alexcjohnson

alexcjohnson Dec 12, 2017

Collaborator

hah yeah that would be cool, but definitely put it off for later.


hoverinfo: extendFlat({}, plotAttrs.hoverinfo, {
flags: ['r', 'theta', 'text', 'name']
}),
hoveron: scatterAttrs.hoveron,

selected: scatterAttrs.selected,
unselected: scatterAttrs.unselected

This comment has been minimized.

Copy link
@chriddyp

chriddyp Dec 12, 2017

Member

🎉

};

0 comments on commit 853581e

Please sign in to comment.