|
| 1 | +/** |
| 2 | +* Copyright 2012-2016, 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 scatterAttrs = require('../scatter/attributes'); |
| 12 | +var colorAttributes = require('../../components/colorscale/color_attributes'); |
| 13 | + |
| 14 | +var extendFlat = require('../../lib/extend').extendFlat; |
| 15 | + |
| 16 | +var scatterLineAttrs = scatterAttrs.line, |
| 17 | + scatterMarkerAttrs = scatterAttrs.marker; |
| 18 | + |
| 19 | +function makeProjectionAttr(axLetter) { |
| 20 | + return { |
| 21 | + show: { |
| 22 | + valType: 'boolean', |
| 23 | + role: 'info', |
| 24 | + dflt: false, |
| 25 | + description: [ |
| 26 | + 'Sets whether or not projections are shown along the', |
| 27 | + axLetter, 'axis.' |
| 28 | + ].join(' ') |
| 29 | + }, |
| 30 | + opacity: { |
| 31 | + valType: 'number', |
| 32 | + role: 'style', |
| 33 | + min: 0, |
| 34 | + max: 1, |
| 35 | + dflt: 1, |
| 36 | + description: 'Sets the projection color.' |
| 37 | + }, |
| 38 | + scale: { |
| 39 | + valType: 'number', |
| 40 | + role: 'style', |
| 41 | + min: 0, |
| 42 | + max: 10, |
| 43 | + dflt: 2 / 3, |
| 44 | + description: [ |
| 45 | + 'Sets the scale factor determining the size of the', |
| 46 | + 'projection marker points.' |
| 47 | + ].join(' ') |
| 48 | + } |
| 49 | + }; |
| 50 | +} |
| 51 | + |
| 52 | +module.exports = { |
| 53 | + x: { |
| 54 | + valType: 'data_array', |
| 55 | + description: 'Sets the x coordinates.' |
| 56 | + }, |
| 57 | + y: { |
| 58 | + valType: 'data_array', |
| 59 | + description: 'Sets the y coordinates.' |
| 60 | + }, |
| 61 | + z: { |
| 62 | + valType: 'data_array', |
| 63 | + description: 'Sets the z coordinates.' |
| 64 | + }, |
| 65 | + text: extendFlat({}, scatterAttrs.text, { |
| 66 | + description: [ |
| 67 | + 'Sets text elements associated with each (x,y,z) triplet.', |
| 68 | + 'If a single string, the same string appears over', |
| 69 | + 'all the data points.', |
| 70 | + 'If an array of string, the items are mapped in order to the', |
| 71 | + 'this trace\'s (x,y,z) coordinates.' |
| 72 | + ].join(' ') |
| 73 | + }), |
| 74 | + mode: extendFlat({}, scatterAttrs.mode, // shouldn't this be on-par with 2D? |
| 75 | + {dflt: 'lines+markers'}), |
| 76 | + projection: { |
| 77 | + x: makeProjectionAttr('x'), |
| 78 | + y: makeProjectionAttr('y'), |
| 79 | + z: makeProjectionAttr('z') |
| 80 | + }, |
| 81 | + connectgaps: scatterAttrs.connectgaps, |
| 82 | + line: extendFlat({}, { |
| 83 | + width: scatterLineAttrs.width, |
| 84 | + connectionradius: extendFlat({}, scatterMarkerAttrs.size, { |
| 85 | + dflt: 1, |
| 86 | + description: 'Sets the radius of the line connection. Either a number, or an array with as many elements as the number of points.' |
| 87 | + }), |
| 88 | + showscale: { |
| 89 | + valType: 'boolean', |
| 90 | + role: 'info', |
| 91 | + dflt: false, |
| 92 | + description: [ |
| 93 | + 'Has an effect only if `line.color` is set to a numerical array.', |
| 94 | + 'Determines whether or not a colorbar is displayed.' |
| 95 | + ].join(' ') |
| 96 | + } |
| 97 | + }, |
| 98 | + colorAttributes('line') |
| 99 | + ), |
| 100 | + marker: extendFlat({}, { |
| 101 | + size: extendFlat({}, scatterMarkerAttrs.size, {dflt: 8}), |
| 102 | + sizeref: scatterMarkerAttrs.sizeref, |
| 103 | + sizemin: scatterMarkerAttrs.sizemin, |
| 104 | + sizemode: scatterMarkerAttrs.sizemode, |
| 105 | + opacity: extendFlat({}, scatterMarkerAttrs.opacity, { |
| 106 | + arrayOk: false, |
| 107 | + description: [ |
| 108 | + 'Sets the marker opacity.', |
| 109 | + 'Note that the marker opacity for scatter3d traces', |
| 110 | + 'must be a scalar value for performance reasons.', |
| 111 | + 'To set a blending opacity value', |
| 112 | + '(i.e. which is not transparent), set *marker.color*', |
| 113 | + 'to an rgba color and use its alpha channel.' |
| 114 | + ].join(' ') |
| 115 | + }), |
| 116 | + showscale: scatterMarkerAttrs.showscale |
| 117 | + }, |
| 118 | + colorAttributes('marker') |
| 119 | + ), |
| 120 | + textposition: extendFlat({}, scatterAttrs.textposition, {dflt: 'top center'}), |
| 121 | + textfont: scatterAttrs.textfont, |
| 122 | + _nestedModules: { |
| 123 | + 'marker.colorbar': 'Colorbar' |
| 124 | + } |
| 125 | +}; |
0 commit comments