|
| 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 boxAttrs = require('../box/attributes'); |
| 12 | +var scatterAttrs = require('../scatter/attributes'); |
| 13 | +var extendFlat = require('../../lib/extend').extendFlat; |
| 14 | + |
| 15 | +module.exports = { |
| 16 | + y: boxAttrs.y, |
| 17 | + x: boxAttrs.x, |
| 18 | + x0: boxAttrs.x0, |
| 19 | + y0: boxAttrs.y0, |
| 20 | + name: boxAttrs.name, |
| 21 | + orientation: extendFlat({}, boxAttrs.orientation, { |
| 22 | + description: [ |
| 23 | + 'Sets the orientation of the violin(s).', |
| 24 | + 'If *v* (*h*), the distribution is visualized along', |
| 25 | + 'the vertical (horizontal).' |
| 26 | + ].join(' ') |
| 27 | + }), |
| 28 | + |
| 29 | + bandwidth: { |
| 30 | + valType: 'number', |
| 31 | + min: 0, |
| 32 | + role: 'info', |
| 33 | + editType: 'plot', |
| 34 | + description: [ |
| 35 | + 'Sets the bandwidth used to compute the kernel density estimate.', |
| 36 | + 'By default, the bandwidth is determined by Silverman\'s rule of thumb.' |
| 37 | + ].join(' ') |
| 38 | + }, |
| 39 | + scaleby: { |
| 40 | + valType: 'enumerated', |
| 41 | + values: ['width', 'area', 'count'], |
| 42 | + dflt: 'width', |
| 43 | + role: 'info', |
| 44 | + editType: 'calc', |
| 45 | + description: [ |
| 46 | + 'Sets the method by which the width of each violin is determined.', |
| 47 | + '*width* means each violin has the same (max) width', |
| 48 | + '*area* means each violin has the same area', |
| 49 | + '*count* means the violins are scaled by the number of sample points making', |
| 50 | + 'up each violin.' |
| 51 | + ].join('') |
| 52 | + }, |
| 53 | + span: { |
| 54 | + valType: 'info_array', |
| 55 | + items: [ |
| 56 | + {valType: 'any', editType: 'plot'}, |
| 57 | + {valType: 'any', editType: 'plot'} |
| 58 | + ], |
| 59 | + role: 'info', |
| 60 | + editType: 'plot', |
| 61 | + description: [ |
| 62 | + 'Sets the span in data space for which the density function will be computed.', |
| 63 | + 'By default, the span goes from the minimum value to maximum value in the sample.' |
| 64 | + ].join(' ') |
| 65 | + }, |
| 66 | + side: { |
| 67 | + valType: 'enumerated', |
| 68 | + values: ['both', 'left', 'right'], |
| 69 | + dflt: 'both', |
| 70 | + role: 'info', |
| 71 | + editType: 'plot', |
| 72 | + description: [ |
| 73 | + 'Determines which side of the position line the density function making up', |
| 74 | + 'one half of a is plotting.', |
| 75 | + 'Useful when comparing two violin traces under *overlay* mode, where one trace.' |
| 76 | + ].join(' ') |
| 77 | + }, |
| 78 | + |
| 79 | + // TODO update description |
| 80 | + points: boxAttrs.boxpoints, |
| 81 | + jitter: boxAttrs.jitter, |
| 82 | + pointpos: boxAttrs.pointpos, |
| 83 | + marker: boxAttrs.marker, |
| 84 | + text: boxAttrs.text, |
| 85 | + |
| 86 | + // TODO need attribute(s) similar to 'boxmean' to toggle lines for: |
| 87 | + // - mean |
| 88 | + // - median |
| 89 | + // - std |
| 90 | + // - quartiles |
| 91 | + |
| 92 | + line: { |
| 93 | + color: { |
| 94 | + valType: 'color', |
| 95 | + role: 'style', |
| 96 | + editType: 'style', |
| 97 | + description: 'Sets the color of line bounding the violin(s).' |
| 98 | + }, |
| 99 | + width: { |
| 100 | + valType: 'number', |
| 101 | + role: 'style', |
| 102 | + min: 0, |
| 103 | + dflt: 2, |
| 104 | + editType: 'style', |
| 105 | + description: 'Sets the width (in px) of line bounding the violin(s).' |
| 106 | + }, |
| 107 | + smoothing: scatterAttrs.line.smoothing, |
| 108 | + editType: 'plot' |
| 109 | + }, |
| 110 | + |
| 111 | + fillcolor: boxAttrs.fillcolor, |
| 112 | + hoveron: boxAttrs.hoveron |
| 113 | +}; |
0 commit comments