|
| 1 | +/** |
| 2 | +* Copyright 2012-2019, 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 colorscaleAttrs = require('../../components/colorscale/attributes'); |
| 12 | +var isosurfaceAttrs = require('../isosurface/attributes'); |
| 13 | +var baseAttrs = require('../../plots/attributes'); |
| 14 | + |
| 15 | +var extendFlat = require('../../lib/extend').extendFlat; |
| 16 | +var overrideAll = require('../../plot_api/edit_types').overrideAll; |
| 17 | + |
| 18 | +var attrs = module.exports = overrideAll(extendFlat({ |
| 19 | + x: isosurfaceAttrs.x, |
| 20 | + y: isosurfaceAttrs.y, |
| 21 | + z: isosurfaceAttrs.z, |
| 22 | + value: isosurfaceAttrs.value, |
| 23 | + isomin: isosurfaceAttrs.isomin, |
| 24 | + isomax: isosurfaceAttrs.isomax, |
| 25 | + surface: isosurfaceAttrs.surface, |
| 26 | + spaceframe: { |
| 27 | + show: { |
| 28 | + valType: 'boolean', |
| 29 | + role: 'info', |
| 30 | + dflt: false, |
| 31 | + description: [ |
| 32 | + 'Displays/hides tetrahedron shapes between minimum and', |
| 33 | + 'maximum iso-values. Often useful when either caps or', |
| 34 | + 'surfaces are disabled or filled with values less than 1.' |
| 35 | + ].join(' ') |
| 36 | + }, |
| 37 | + fill: { |
| 38 | + valType: 'number', |
| 39 | + role: 'style', |
| 40 | + min: 0, |
| 41 | + max: 1, |
| 42 | + dflt: 1, |
| 43 | + description: [ |
| 44 | + 'Sets the fill ratio of the `spaceframe` elements. The default fill value', |
| 45 | + 'is 1 meaning that they are entirely shaded. Applying a `fill` ratio less', |
| 46 | + 'than one would allow the creation of openings parallel to the edges.' |
| 47 | + ].join(' ') |
| 48 | + } |
| 49 | + }, |
| 50 | + |
| 51 | + slices: isosurfaceAttrs.slices, |
| 52 | + caps: isosurfaceAttrs.caps, |
| 53 | + text: isosurfaceAttrs.text, |
| 54 | + hovertext: isosurfaceAttrs.hovertext, |
| 55 | + hovertemplate: isosurfaceAttrs.hovertemplate |
| 56 | +}, |
| 57 | + |
| 58 | +colorscaleAttrs('', { |
| 59 | + colorAttr: '`value`', |
| 60 | + showScaleDflt: true, |
| 61 | + editTypeOverride: 'calc' |
| 62 | +}), { |
| 63 | + |
| 64 | + colorbar: isosurfaceAttrs.colorbar, |
| 65 | + opacity: isosurfaceAttrs.opacity, |
| 66 | + opacityscale: { |
| 67 | + valType: 'any', |
| 68 | + role: 'style', |
| 69 | + editType: 'calc', |
| 70 | + description: [ |
| 71 | + 'Sets the opacityscale.', |
| 72 | + ' The opacityscale must be an array containing', |
| 73 | + ' arrays mapping a normalized value to an opacity value.', |
| 74 | + ' At minimum, a mapping for the lowest (0) and highest (1)', |
| 75 | + ' values are required. For example,', |
| 76 | + ' `[[0, 1], [0.5, 0.2], [1, 1]]` means that higher/lower values would have', |
| 77 | + ' higher opacity values and those in the middle would be more transparent', |
| 78 | + ' Alternatively, `opacityscale` may be a palette name string', |
| 79 | + ' of the following list: \'min\', \'max\', \'extremes\' and \'uniform\'.', |
| 80 | + ' The default is \'uniform\'.' |
| 81 | + ].join('') |
| 82 | + }, |
| 83 | + |
| 84 | + lightposition: isosurfaceAttrs.lightposition, |
| 85 | + lighting: isosurfaceAttrs.lighting, |
| 86 | + flatshading: isosurfaceAttrs.flatshading, |
| 87 | + contour: isosurfaceAttrs.contour, |
| 88 | + |
| 89 | + hoverinfo: extendFlat({}, baseAttrs.hoverinfo) |
| 90 | +}), 'calc', 'nested'); |
| 91 | + |
| 92 | +attrs.x.editType = attrs.y.editType = attrs.z.editType = attrs.value.editType = 'calc+clearAxisTypes'; |
| 93 | +attrs.transforms = undefined; |
0 commit comments