🤖 Merge PR #44415 add optional scale argument to ToImgopts interface by @m55c55

* add optional scale argument to ToImgopts interface

* add test

Co-authored-by: Valentin Steinwandter <valentin.steinwandter@exputec.com>
This commit is contained in:
m55c55 2020-05-01 20:16:47 +02:00 committed by GitHub
parent 0b65c0b51c
commit 05c6e0b1fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -178,6 +178,7 @@ export interface ToImgopts {
format: 'jpeg' | 'png' | 'webp' | 'svg';
width: number;
height: number;
scale?: number;
}
export interface DownloadImgopts {

View File

@ -265,6 +265,17 @@ function rand() {
})();
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
// Plotly.toImage + scale parameter
(() => {
// Plotly.toImage will turn the plot in the given div into a data URL string
// toImage takes the div as the first argument and an object specifying image properties as the other
Plotly.toImage(graphDiv, { format: 'png', width: 800, height: 600, scale: 2 }).then((dataUrl) => {
// use the dataUrl
});
})();
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
// Plotly.downloadImage
(() => {