Skip to content

Commit 8429245

Browse files
committed
image: attributes
1 parent d41159b commit 8429245

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed

src/traces/image/attributes.js

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
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 plotAttrs = require('../../plots/attributes');
12+
var hovertemplateAttrs = require('../../plots/template_attributes').hovertemplateAttrs;
13+
var extendFlat = require('../../lib/extend').extendFlat;
14+
15+
module.exports = extendFlat({
16+
z: {
17+
valType: 'data_array',
18+
role: 'info',
19+
editType: 'calc',
20+
description: [
21+
'A 2-dimensional array in which each element is an array of 3 or 4 numbers representing a color.',
22+
].join(' ')
23+
},
24+
colormodel: {
25+
valType: 'enumerated',
26+
values: ['rgb', 'rgba', 'hsl', 'hsla'],
27+
dflt: 'rgb',
28+
role: 'info',
29+
editType: 'plot',
30+
description: 'Color model used to map the numerical color components described in `z` into colors.'
31+
},
32+
zmin: {
33+
valType: 'data_array',
34+
role: 'info',
35+
editType: 'plot',
36+
description: [
37+
'Array defining the lower bound for each color component.',
38+
'For example, for the `rgba` colormodel, the default value is [0, 0, 0, 0].'
39+
].join(' ')
40+
},
41+
zmax: {
42+
valType: 'data_array',
43+
role: 'info',
44+
editType: 'plot',
45+
description: [
46+
'Array defining the higher bound for each color component.',
47+
'For example, for the `rgba` colormodel, the default value is [255, 255, 255, 1].'
48+
].join(' ')
49+
},
50+
x0: {
51+
valType: 'number',
52+
dflt: 0,
53+
role: 'info',
54+
editType: 'calc',
55+
description: 'Set the image\'s x position.'
56+
},
57+
y0: {
58+
valType: 'number',
59+
dflt: 0,
60+
role: 'info',
61+
editType: 'calc',
62+
description: 'Set the image\'s y position.'
63+
},
64+
dx: {
65+
valType: 'number',
66+
dflt: 1,
67+
role: 'info',
68+
editType: 'calc',
69+
description: 'Set the pixel\'s horizontal size.'
70+
},
71+
dy: {
72+
valType: 'number',
73+
dflt: 1,
74+
role: 'info',
75+
editType: 'calc',
76+
description: 'Set the pixel\'s vertical size'
77+
},
78+
hoverinfo: extendFlat({}, plotAttrs.hoverinfo, {
79+
flags: ['x', 'y', 'z', 'color', 'name']
80+
}),
81+
hovertemplate: hovertemplateAttrs({}, {
82+
keys: ['z', 'c', 'colormodel']
83+
})
84+
});

0 commit comments

Comments
 (0)