|
| 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 colorAttributes = require('../../components/colorscale/color_attributes'); |
| 12 | +var colorbarAttrs = require('../../components/colorbar/attributes'); |
| 13 | + |
| 14 | +var extendFlat = require('../../lib/extend').extendFlat; |
| 15 | + |
| 16 | +/* |
| 17 | +todo comments (some of them relating to items that should be unexposed anyway): |
| 18 | +- `domain` should be DRYed up across other plots |
| 19 | +- add attribute to `dimensions` for switching dimensions on/off |
| 20 | +- add attribute to `dimensions` for initial filter domain |
| 21 | +- clarify what the actual use of `_isLinkedToArray: 'dimension'` - esp. the value - is below |
| 22 | +- add attribute for color clamping |
| 23 | +- switch to ploty standard color notation rather than RGB tuple |
| 24 | +- switch to 0..1 for opacity rather than 0..255 |
| 25 | +- tie pixelratio to window.devicePixelRatio in `defaults.js` |
| 26 | +- consider if we need a `focusopacity` attribute besides focusalphablending; making settings more symmetric between |
| 27 | + focus and context |
| 28 | +- hardcode verticalpadding |
| 29 | +- this minor but ergonomic `integerpadding` isn't fully working yet - either finish it or remove it |
| 30 | +*/ |
| 31 | + |
| 32 | +module.exports = { |
| 33 | + |
| 34 | + domain: { |
| 35 | + x: { |
| 36 | + valType: 'info_array', |
| 37 | + role: 'info', |
| 38 | + items: [ |
| 39 | + {valType: 'number', min: 0, max: 1}, |
| 40 | + {valType: 'number', min: 0, max: 1} |
| 41 | + ], |
| 42 | + dflt: [0, 1], |
| 43 | + description: [ |
| 44 | + 'Sets the horizontal domain of this `parcoords` trace', |
| 45 | + '(in plot fraction).' |
| 46 | + ].join(' ') |
| 47 | + }, |
| 48 | + y: { |
| 49 | + valType: 'info_array', |
| 50 | + role: 'info', |
| 51 | + items: [ |
| 52 | + {valType: 'number', min: 0, max: 1}, |
| 53 | + {valType: 'number', min: 0, max: 1} |
| 54 | + ], |
| 55 | + dflt: [0, 1], |
| 56 | + description: [ |
| 57 | + 'Sets the vertical domain of this `parcoords` trace', |
| 58 | + '(in plot fraction).' |
| 59 | + ].join(' ') |
| 60 | + } |
| 61 | + }, |
| 62 | + |
| 63 | + dimensions: { |
| 64 | + _isLinkedToArray: 'dimension', |
| 65 | + id: { |
| 66 | + valType: 'string', |
| 67 | + role: 'info', |
| 68 | + description: 'Identifier of a dimension. Must be a unique string across all dimensions.' |
| 69 | + }, |
| 70 | + label: { |
| 71 | + valType: 'string', |
| 72 | + role: 'info', |
| 73 | + description: 'The shown name of the dimension.' |
| 74 | + }, |
| 75 | + integer: { |
| 76 | + valType: 'boolean', |
| 77 | + dflt: false, |
| 78 | + role: 'info', |
| 79 | + description: 'The shown name of the dimension.' |
| 80 | + }, |
| 81 | + values: { |
| 82 | + valType: 'data_array', |
| 83 | + role: 'info', |
| 84 | + description: [ |
| 85 | + 'Dimension values. `values[n]` represents the value of the `n`th point in the dataset,', |
| 86 | + 'therefore the `values` vector for all dimensions must be the same (longer vectors', |
| 87 | + 'will be truncated). Each value must be a finite number.' |
| 88 | + ].join(' ') |
| 89 | + }, |
| 90 | + description: 'The dimensions (variables) of the parallel coordinates chart.' |
| 91 | + }, |
| 92 | + |
| 93 | + tickdistance: { |
| 94 | + valType: 'number', |
| 95 | + dflt: 50, |
| 96 | + min: 32, |
| 97 | + role: 'style', |
| 98 | + description: 'The desired approximate tick distance (in pixels) between axis ticks on an axis.' |
| 99 | + }, |
| 100 | + |
| 101 | + line: extendFlat({}, |
| 102 | + colorAttributes('line'), |
| 103 | + { |
| 104 | + showscale: { |
| 105 | + valType: 'boolean', |
| 106 | + role: 'info', |
| 107 | + dflt: false, |
| 108 | + description: [ |
| 109 | + 'Has an effect only if `marker.color` is set to a numerical array.', |
| 110 | + 'Determines whether or not a colorbar is displayed.' |
| 111 | + ].join(' ') |
| 112 | + }, |
| 113 | + colorbar: colorbarAttrs |
| 114 | + } |
| 115 | + ), |
| 116 | + |
| 117 | + lines: { |
| 118 | + contextcolor: { |
| 119 | + valType: 'data_array', |
| 120 | + dflt: [0, 0, 0], |
| 121 | + role: 'style', |
| 122 | + description: 'Color of the context line layer as an RGB triplet where each number is 0..255.' |
| 123 | + }, |
| 124 | + |
| 125 | + contextopacity: { |
| 126 | + valType: 'number', |
| 127 | + dflt: 16, |
| 128 | + min: 0, |
| 129 | + max: 255, |
| 130 | + role: 'style', |
| 131 | + description: 'Opacity of the context lines, on a scale of 0 (invisible) to 255 (fully opaque).' |
| 132 | + }, |
| 133 | + |
| 134 | + pixelratio: { |
| 135 | + valType: 'number', |
| 136 | + dflt: 1, |
| 137 | + min: 0.25, |
| 138 | + max: 4, |
| 139 | + role: 'style', |
| 140 | + description: 'Line rendering pixel ratio. A lower value yields faster rendering but blockier lines.' |
| 141 | + }, |
| 142 | + |
| 143 | + blocklinecount: { |
| 144 | + valType: 'number', |
| 145 | + dflt: 5000, |
| 146 | + min: 1, |
| 147 | + role: 'info', |
| 148 | + description: [ |
| 149 | + 'The number of lines rendered in one 16ms rendering frame. Use 2000-5000 on low-end hardware to remain', |
| 150 | + 'responsive, and 10000 .. 100000 on strong hardware for faster rendering.' |
| 151 | + ].join(' ') |
| 152 | + }, |
| 153 | + |
| 154 | + focusalphablending: { |
| 155 | + valType: 'boolean', |
| 156 | + dflt: false, |
| 157 | + role: 'style', |
| 158 | + description: [ |
| 159 | + 'By default, the rendered lines are opaque. Setting it to `true` is necessary if opacity is needed.' |
| 160 | + ].join(' ') |
| 161 | + }, |
| 162 | + |
| 163 | + verticalpadding: { |
| 164 | + valType: 'number', |
| 165 | + dflt: 2, |
| 166 | + min: 0, |
| 167 | + max: 4, |
| 168 | + role: 'style', |
| 169 | + description: 'Lines have thickness, and without padding, horizontal lines at extreme values appear thinner.' |
| 170 | + }, |
| 171 | + |
| 172 | + integerpadding: { |
| 173 | + valType: 'number', |
| 174 | + dflt: 0, |
| 175 | + min: 0, |
| 176 | + max: 1, |
| 177 | + role: 'style', |
| 178 | + description: 'Setting it to `1` offsets the extreme points on integer axes by half pitch.' |
| 179 | + } |
| 180 | + }, |
| 181 | + |
| 182 | + filterbar: { |
| 183 | + |
| 184 | + width: { |
| 185 | + valType: 'number', |
| 186 | + dflt: 4, |
| 187 | + min: 2, |
| 188 | + max: 20, |
| 189 | + role: 'style', |
| 190 | + description: 'Visible width of the filter bar.' |
| 191 | + }, |
| 192 | + |
| 193 | + fillcolor: { |
| 194 | + valType: 'color', |
| 195 | + dflt: 'magenta', |
| 196 | + role: 'style', |
| 197 | + description: 'Color of the filter bar fill.' |
| 198 | + }, |
| 199 | + |
| 200 | + fillopacity: { |
| 201 | + valType: 'number', |
| 202 | + dflt: 1, |
| 203 | + min: 0, |
| 204 | + max: 1, |
| 205 | + role: 'style', |
| 206 | + description: 'Filter bar fill opacity.' |
| 207 | + }, |
| 208 | + |
| 209 | + strokecolor: { |
| 210 | + valType: 'color', |
| 211 | + dflt: 'white', |
| 212 | + role: 'style', |
| 213 | + description: 'Color of the filter bar side lines.' |
| 214 | + }, |
| 215 | + |
| 216 | + strokeopacity: { |
| 217 | + valType: 'number', |
| 218 | + dflt: 1, |
| 219 | + min: 0, |
| 220 | + max: 1, |
| 221 | + arrayOk: true, |
| 222 | + role: 'style', |
| 223 | + description: 'Filter bar side stroke opacity.' |
| 224 | + }, |
| 225 | + |
| 226 | + strokewidth: { |
| 227 | + valType: 'number', |
| 228 | + dflt: 1, |
| 229 | + min: 0, |
| 230 | + max: 2, |
| 231 | + role: 'style', |
| 232 | + description: 'Filter bar side stroke width.' |
| 233 | + }, |
| 234 | + |
| 235 | + handleheight: { |
| 236 | + valType: 'number', |
| 237 | + dflt: 16, |
| 238 | + min: 2, |
| 239 | + max: 20, |
| 240 | + role: 'style', |
| 241 | + description: 'Height of the filter bar vertical resize areas on top and bottom.' |
| 242 | + }, |
| 243 | + |
| 244 | + handleopacity: { |
| 245 | + valType: 'number', |
| 246 | + dflt: 1, |
| 247 | + min: 0, |
| 248 | + max: 1, |
| 249 | + arrayOk: true, |
| 250 | + role: 'style', |
| 251 | + description: 'Opacity of the filter bar vertical resize areas on top and bottom.' |
| 252 | + }, |
| 253 | + |
| 254 | + handleoverlap: { |
| 255 | + valType: 'number', |
| 256 | + dflt: 0, |
| 257 | + min: 0, |
| 258 | + max: 4, |
| 259 | + role: 'style', |
| 260 | + description: [ |
| 261 | + 'If zero, the vertical resize areas on top and bottom are just above and below the filter bar itself.', |
| 262 | + 'A larger than zero value causes overlaps with the filter bar. The overlap is represented as pixels.' |
| 263 | + ].join(' ') |
| 264 | + } |
| 265 | + } |
| 266 | +}; |
0 commit comments