diff --git a/types/plotly.js/index.d.ts b/types/plotly.js/index.d.ts index 6b55bcdf65..4a03541820 100644 --- a/types/plotly.js/index.d.ts +++ b/types/plotly.js/index.d.ts @@ -178,6 +178,7 @@ export interface ToImgopts { format: 'jpeg' | 'png' | 'webp' | 'svg'; width: number; height: number; + scale?: number; } export interface DownloadImgopts { diff --git a/types/plotly.js/test/core-tests.ts b/types/plotly.js/test/core-tests.ts index fb44e77450..fece5136b6 100644 --- a/types/plotly.js/test/core-tests.ts +++ b/types/plotly.js/test/core-tests.ts @@ -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 (() => {