Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes in SaveChartAsImage.js #664

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

eaglus
Copy link
Contributor

@eaglus eaglus commented Oct 8, 2018

fixes in SaveChartAsImage.js

  1. use devicePixelRatio / backingStorePixelRatio for correct image scaling on Retina devices

  2. use file-saver for correct image saving on IE/Edge/Safari

  3. add canvg parameter for fallback when saving in IE11/Edge (IE has security bug when trying to save canvas with any svg image painted on).
    See https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/1015651/ or similar bugreports.
    See description for canvg parameter here: https://github.com/exupero/saveSvgAsPng (canvg - If canvg is passed in, it will be used to write svg to canvas. This will allow support for Internet Explorer)

  4. Add paddings parameter to save functions

  5. Add save-svg-as-png workaround to fix bug with saving on IE11: we want width/height from svg, because Image.width/height returns 0 in IE11.
    Maybe, this bug exits only when we set image.src to svg as dataurl...
    Anyway, this bug exists, and we need some workaround for it.

  6. Use file-saver https://github.com/eligrey/FileSaver.js to have correct cross-platform image saving (solution with tag does not work on IE11/Edge, and Safari).

  7. Add polyfills to documentation pages (for IE11 compatibility): @babel/polyfill, blueimp-canvas-to-blob, and canvg.
    Also, use saveChartAsImageWithOptions method to send canvg parameter for IE11/Edge compatibility

1. devicePixelRatio / backingStorePixelRatio for correct image scaling on Retina devices
2. use file-saver for correct image saving on IE/Edge/Safari
3. add canvg parameter for fallback when saving in IE11/Edge (IE has security bug when trying to save canvas with any svg image painted on). See https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/1015651/ or similar bugreports. See description for canvg parameter here: https://github.com/exupero/saveSvgAsPng (canvg - If canvg is passed in, it will be used to write svg to canvas. This will allow support for Internet Explorer)
4. Add paddings parameter to save functions
5. Add save-svg-as-png workaround to fix bug with saving on IE11: we want width/height from svg, because Image.width/height returns 0 in IE11. because Image.width/height returns 0 in IE11. Maybe, this bug exits only when we set image.src to svg as dataurl... Anyway, this bug exists, and we need some workaround for it.
6. Add polyfills to documentation pages (for IE11 compatibility): @babel/polyfill, blueimp-canvas-to-blob, and canvg.
@eaglus eaglus changed the title fix SaveChartAsImage.js: fixes in SaveChartAsImage.js Oct 8, 2018
@eaglus
Copy link
Contributor Author

eaglus commented Nov 6, 2018

@rrag Please merge this PR, it fixes a lot of chart saving issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant