|
| 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 colorAttributes = require('../../components/colorscale/color_attributes'); |
| 12 | +var colorbarAttrs = require('../../components/colorbar/attributes'); |
| 13 | +var colorscales = require('../../components/colorscale/scales'); |
| 14 | +var axesAttrs = require('../../plots/cartesian/layout_attributes'); |
| 15 | +var fontAttrs = require('../../plots/font_attributes'); |
| 16 | + |
| 17 | +var extendDeep = require('../../lib/extend').extendDeep; |
| 18 | +var extendFlat = require('../../lib/extend').extendFlat; |
| 19 | + |
| 20 | +module.exports = { |
| 21 | + |
| 22 | + domain: { |
| 23 | + x: { |
| 24 | + valType: 'info_array', |
| 25 | + role: 'info', |
| 26 | + items: [ |
| 27 | + {valType: 'number', min: 0, max: 1}, |
| 28 | + {valType: 'number', min: 0, max: 1} |
| 29 | + ], |
| 30 | + dflt: [0, 1], |
| 31 | + description: [ |
| 32 | + 'Sets the horizontal domain of this `table` trace', |
| 33 | + '(in plot fraction).' |
| 34 | + ].join(' ') |
| 35 | + }, |
| 36 | + y: { |
| 37 | + valType: 'info_array', |
| 38 | + role: 'info', |
| 39 | + items: [ |
| 40 | + {valType: 'number', min: 0, max: 1}, |
| 41 | + {valType: 'number', min: 0, max: 1} |
| 42 | + ], |
| 43 | + dflt: [0, 1], |
| 44 | + description: [ |
| 45 | + 'Sets the vertical domain of this `table` trace', |
| 46 | + '(in plot fraction).' |
| 47 | + ].join(' ') |
| 48 | + } |
| 49 | + }, |
| 50 | + |
| 51 | + labelfont: extendFlat({}, fontAttrs, { |
| 52 | + description: 'Sets the font for the `dimension` labels.' |
| 53 | + }), |
| 54 | + |
| 55 | + dimensions: { |
| 56 | + _isLinkedToArray: 'dimension', |
| 57 | + label: { |
| 58 | + valType: 'string', |
| 59 | + role: 'info', |
| 60 | + description: 'The shown name of the dimension.' |
| 61 | + }, |
| 62 | + tickvals: axesAttrs.tickvals, |
| 63 | + ticktext: axesAttrs.ticktext, |
| 64 | + font: extendFlat({}, fontAttrs, { |
| 65 | + description: 'Sets the font for the `dimension` values.' |
| 66 | + }), |
| 67 | + valueformat: { |
| 68 | + valType: 'string', |
| 69 | + dflt: '3s', |
| 70 | + role: 'style', |
| 71 | + description: [ |
| 72 | + 'Sets the tick label formatting rule using d3 formatting mini-language', |
| 73 | + 'which is similar to those of Python. See', |
| 74 | + 'https://github.com/d3/d3-format/blob/master/README.md#locale_format' |
| 75 | + ].join(' ') |
| 76 | + }, |
| 77 | + visible: { |
| 78 | + valType: 'boolean', |
| 79 | + dflt: true, |
| 80 | + role: 'info', |
| 81 | + description: 'Shows the dimension when set to `true` (the default). Hides the dimension for `false`.' |
| 82 | + }, |
| 83 | + range: { |
| 84 | + valType: 'info_array', |
| 85 | + role: 'info', |
| 86 | + items: [ |
| 87 | + {valType: 'number'}, |
| 88 | + {valType: 'number'} |
| 89 | + ], |
| 90 | + description: [ |
| 91 | + 'The domain range for the purpose of coloring. Defaults to the `values` extent.', |
| 92 | + 'Must be an array of `[fromValue, toValue]` with finite numbers as elements.' |
| 93 | + ].join(' ') |
| 94 | + }, |
| 95 | + values: { |
| 96 | + valType: 'data_array', |
| 97 | + role: 'info', |
| 98 | + dflt: [], |
| 99 | + description: [ |
| 100 | + 'Dimension values. `values[n]` represents the value of the `n`th point in the dataset,', |
| 101 | + 'therefore the `values` vector for all dimensions must be the same (longer vectors', |
| 102 | + 'will be truncated). Each value must be a finite number.' |
| 103 | + ].join(' ') |
| 104 | + }, |
| 105 | + description: 'The dimensions (variables) of the table view.' |
| 106 | + }, |
| 107 | + |
| 108 | + line: extendFlat({}, |
| 109 | + |
| 110 | + // the default autocolorscale is set to Viridis - autocolorscale therefore defaults to false too, |
| 111 | + // to avoid being overridden by the blue-white-red autocolor palette |
| 112 | + extendDeep( |
| 113 | + {}, |
| 114 | + colorAttributes('line'), |
| 115 | + { |
| 116 | + colorscale: extendDeep( |
| 117 | + {}, |
| 118 | + colorAttributes('line').colorscale, |
| 119 | + {dflt: colorscales.Viridis} |
| 120 | + ), |
| 121 | + autocolorscale: extendDeep( |
| 122 | + {}, |
| 123 | + colorAttributes('line').autocolorscale, |
| 124 | + { |
| 125 | + dflt: false, |
| 126 | + description: [ |
| 127 | + 'Has an effect only if line.color` is set to a numerical array.', |
| 128 | + 'Determines whether the colorscale is a default palette (`autocolorscale: true`)', |
| 129 | + 'or the palette determined by `line.colorscale`.', |
| 130 | + 'In case `colorscale` is unspecified or `autocolorscale` is true, the default ', |
| 131 | + 'palette will be chosen according to whether numbers in the `color` array are', |
| 132 | + 'all positive, all negative or mixed.', |
| 133 | + 'The default value is false, so that `table` colorscale can default to `Viridis`.' |
| 134 | + ].join(' ') |
| 135 | + } |
| 136 | + ) |
| 137 | + |
| 138 | + } |
| 139 | + ), |
| 140 | + |
| 141 | + { |
| 142 | + showscale: { |
| 143 | + valType: 'boolean', |
| 144 | + role: 'info', |
| 145 | + dflt: false, |
| 146 | + description: [ |
| 147 | + 'Has an effect only if `line.color` is set to a numerical array.', |
| 148 | + 'Determines whether or not a colorbar is displayed.' |
| 149 | + ].join(' ') |
| 150 | + }, |
| 151 | + colorbar: colorbarAttrs |
| 152 | + } |
| 153 | + ) |
| 154 | +}; |
0 commit comments