Skip to content

Commit d0bfe54

Browse files
authored
Merge pull request #1215 from plotly/toImageButtonsOptions-document
document toImageButtonOptions in javascript
2 parents 87d357b + 003175c commit d0bfe54

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
name: Customize Download Plot Options
3+
plot_url: https://codepen.io/plotly/embed/MZjYRB/?height=450&theme-id=15263&default-tab=result
4+
language: plotly_js
5+
suite: configuration
6+
order: 3.1
7+
sitemap: false
8+
arrangement: horizontal
9+
---
10+
var trace1 = {
11+
x: [0, 1, 2, 3, 4, 5, 6],
12+
y: [1, 9, 4, 7, 5, 2, 4],
13+
mode: 'markers',
14+
marker: {
15+
size: [20, 40, 25, 10, 60, 90, 30],
16+
}
17+
};
18+
19+
var data = [trace1];
20+
21+
var layout = {
22+
title: 'Download Chart as SVG instead of PNG',
23+
showlegend: false
24+
};
25+
26+
var config = {
27+
toImageButtonOptions: {
28+
format: 'svg', // one of png, svg, jpeg, webp
29+
filename: 'custom_image',
30+
height: 500,
31+
width: 700,
32+
scale: 1 // Multiply title/legend/axis/canvas sizes by this factor
33+
}
34+
};
35+
36+
Plotly.newPlot('myDiv', data, layout, config);

0 commit comments

Comments
 (0)