|
| 1 | +'use strict'; |
| 2 | + |
| 3 | +var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs; |
| 4 | +var texttemplateAttrs = require('../../plots/template_attributes').texttemplateAttrs; |
| 5 | +var extendFlat = require('../../lib/extend').extendFlat; |
| 6 | +var scatterAttrs = require('../scatter/attributes'); |
| 7 | +var baseAttrs = require('../../plots/attributes'); |
| 8 | +var lineAttrs = scatterAttrs.line; |
| 9 | + |
| 10 | +module.exports = { |
| 11 | + mode: scatterAttrs.mode, |
| 12 | + |
| 13 | + r: { |
| 14 | + valType: 'data_array', |
| 15 | + editType: 'calc+clearAxisTypes', |
| 16 | + description: 'Sets the radial coordinates' |
| 17 | + }, |
| 18 | + |
| 19 | + theta: { |
| 20 | + valType: 'data_array', |
| 21 | + editType: 'calc+clearAxisTypes', |
| 22 | + description: 'Sets the angular coordinates' |
| 23 | + }, |
| 24 | + |
| 25 | + r0: { |
| 26 | + valType: 'any', |
| 27 | + dflt: 0, |
| 28 | + editType: 'calc+clearAxisTypes', |
| 29 | + description: [ |
| 30 | + 'Alternate to `r`.', |
| 31 | + 'Builds a linear space of r coordinates.', |
| 32 | + 'Use with `dr`', |
| 33 | + 'where `r0` is the starting coordinate and `dr` the step.' |
| 34 | + ].join(' ') |
| 35 | + }, |
| 36 | + dr: { |
| 37 | + valType: 'number', |
| 38 | + dflt: 1, |
| 39 | + editType: 'calc', |
| 40 | + description: 'Sets the r coordinate step.' |
| 41 | + }, |
| 42 | + |
| 43 | + theta0: { |
| 44 | + valType: 'any', |
| 45 | + dflt: 0, |
| 46 | + editType: 'calc+clearAxisTypes', |
| 47 | + description: [ |
| 48 | + 'Alternate to `theta`.', |
| 49 | + 'Builds a linear space of theta coordinates.', |
| 50 | + 'Use with `dtheta`', |
| 51 | + 'where `theta0` is the starting coordinate and `dtheta` the step.' |
| 52 | + ].join(' ') |
| 53 | + }, |
| 54 | + dtheta: { |
| 55 | + valType: 'number', |
| 56 | + editType: 'calc', |
| 57 | + description: [ |
| 58 | + 'Sets the theta coordinate step.', |
| 59 | + 'By default, the `dtheta` step equals the subplot\'s period divided', |
| 60 | + 'by the length of the `r` coordinates.' |
| 61 | + ].join(' ') |
| 62 | + }, |
| 63 | + |
| 64 | + thetaunit: { |
| 65 | + valType: 'enumerated', |
| 66 | + values: ['radians', 'degrees', 'gradians'], |
| 67 | + dflt: 'degrees', |
| 68 | + editType: 'calc+clearAxisTypes', |
| 69 | + description: [ |
| 70 | + 'Sets the unit of input *theta* values.', |
| 71 | + 'Has an effect only when on *linear* angular axes.' |
| 72 | + ].join(' ') |
| 73 | + }, |
| 74 | + |
| 75 | + text: scatterAttrs.text, |
| 76 | + texttemplate: texttemplateAttrs({editType: 'plot'}, { |
| 77 | + keys: ['r', 'theta', 'text'] |
| 78 | + }), |
| 79 | + hovertext: scatterAttrs.hovertext, |
| 80 | + |
| 81 | + line: { |
| 82 | + color: lineAttrs.color, |
| 83 | + width: lineAttrs.width, |
| 84 | + dash: lineAttrs.dash, |
| 85 | + shape: extendFlat({}, lineAttrs.shape, { |
| 86 | + values: ['linear', 'spline'] |
| 87 | + }), |
| 88 | + smoothing: lineAttrs.smoothing, |
| 89 | + editType: 'calc' |
| 90 | + }, |
| 91 | + connectgaps: scatterAttrs.connectgaps, |
| 92 | + |
| 93 | + marker: scatterAttrs.marker, |
| 94 | + cliponaxis: extendFlat({}, scatterAttrs.cliponaxis, {dflt: false}), |
| 95 | + |
| 96 | + textposition: scatterAttrs.textposition, |
| 97 | + textfont: scatterAttrs.textfont, |
| 98 | + |
| 99 | + fill: extendFlat({}, scatterAttrs.fill, { |
| 100 | + values: ['none', 'toself', 'tonext'], |
| 101 | + dflt: 'none', |
| 102 | + description: [ |
| 103 | + 'Sets the area to fill with a solid color.', |
| 104 | + 'Use with `fillcolor` if not *none*.', |
| 105 | + 'scatterpolar has a subset of the options available to scatter.', |
| 106 | + '*toself* connects the endpoints of the trace (or each segment', |
| 107 | + 'of the trace if it has gaps) into a closed shape.', |
| 108 | + '*tonext* fills the space between two traces if one completely', |
| 109 | + 'encloses the other (eg consecutive contour lines), and behaves like', |
| 110 | + '*toself* if there is no trace before it. *tonext* should not be', |
| 111 | + 'used if one trace does not enclose the other.' |
| 112 | + ].join(' ') |
| 113 | + }), |
| 114 | + fillcolor: scatterAttrs.fillcolor, |
| 115 | + |
| 116 | + // TODO error bars |
| 117 | + // https://stackoverflow.com/a/26597487/4068492 |
| 118 | + // error_x (error_r, error_theta) |
| 119 | + // error_y |
| 120 | + |
| 121 | + hoverinfo: extendFlat({}, baseAttrs.hoverinfo, { |
| 122 | + flags: ['r', 'theta', 'text', 'name'] |
| 123 | + }), |
| 124 | + hoveron: scatterAttrs.hoveron, |
| 125 | + hovertemplate: hovertemplateAttrs(), |
| 126 | + |
| 127 | + selected: scatterAttrs.selected, |
| 128 | + unselected: scatterAttrs.unselected |
| 129 | +}; |
0 commit comments