Skip to content

Use URL.createObjectURL during Plotly.downloadImage#4008

Merged
etpinard merged 7 commits into
masterfrom
createObjectURL
Jul 3, 2019
Merged

Use URL.createObjectURL during Plotly.downloadImage#4008
etpinard merged 7 commits into
masterfrom
createObjectURL

Conversation

@etpinard

@etpinard etpinard commented Jul 2, 2019

Copy link
Copy Markdown
Contributor

... to not hit the 2MB URL-length limit in Chrome - which resolves #3771 - and improve downloadImage performance.

before: https://codepen.io/anon/pen/WWZBOB
after: https://codepen.io/etpinard/pen/MMGGVW (click to "Download plot as a png" modebar button)

All-format playground: https://codepen.io/etpinard/pen/QXraeW

@plotly/plotly_js

etpinard added 7 commits July 2, 2019 14:16
... to workaround Chrome URL length limit (#3771) and
    probably (not tested) have a perf boost.

    N.B. createObjectURL expects Blob object which itself
    expect data string w/o data:image prefix, so use
    imageDataOnly in the Plotly.toImage call
- so that when we can fallback to window.webkitURL if
  window.URL isn't defined
- which speeds up things for loooong SVG strings
- must (still) use encodeSVG in Safari and IE9
@etpinard etpinard added bug something broken status: reviewable labels Jul 2, 2019
@etpinard etpinard added this to the v1.49.0 milestone Jul 2, 2019
@antoinerg

Copy link
Copy Markdown
Contributor

Looks good to me! Thanks for the improvement 💃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug something broken

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Failed - network error" when downloading large png using toImage button

2 participants