Repository navigation
Expand file tree
/
Copy pathto_image_attributes.ts
More file actions
66 lines (64 loc) · 2.21 KB
/
Copy pathto_image_attributes.ts
File metadata and controls
66 lines (64 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import type { AttributeMap } from '../types/lib/attributes';
/**
* Options for `Plotly.toImage` and `Plotly.downloadImage`.
* `plot_config.js` reuses `format.values` for `config.toImageButtonOptions`.
* A separate module prevents the require cycle that `plot_config.js` would
* close through `to_image.js`.
*/
const attributes = {
format: {
valType: 'enumerated',
values: ['png', 'jpeg', 'webp', 'svg', 'full-json'] as const,
dflt: 'png',
description: 'Sets the format of exported image.'
},
width: {
valType: 'number',
min: 1,
description: [
'Sets the exported image width.',
'Defaults to the value found in `layout.width`',
'If set to *null*, the exported image width will match the current graph width.'
].join(' ')
},
height: {
valType: 'number',
min: 1,
description: [
'Sets the exported image height.',
'Defaults to the value found in `layout.height`',
'If set to *null*, the exported image height will match the current graph height.'
].join(' ')
},
scale: {
valType: 'number',
min: 0,
dflt: 1,
description: [
'Sets a scaling for the generated image.',
'If set, all features of a graphs (e.g. text, line width)',
'are scaled, unlike simply setting',
'a bigger *width* and *height*.'
].join(' ')
},
setBackground: {
valType: 'any',
dflt: false,
description: [
'Sets the image background mode.',
'By default, the image background is determined by `layout.paper_bgcolor`,',
'the *transparent* mode.',
'One might consider setting `setBackground` to *opaque*',
'when exporting a *jpeg* image as JPEGs do not support opacity.'
].join(' ')
},
imageDataOnly: {
valType: 'boolean',
dflt: false,
description: [
'Determines whether or not the return value is prefixed by',
"the image format's corresponding 'data:image;' spec."
].join(' ')
}
} as const satisfies AttributeMap;
export default attributes;