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

fix(svg): fix chart cannot be exported with SVG renderer in IE. #13732

Merged
merged 7 commits into from Dec 18, 2020

Conversation

plainheart
Copy link
Member

@plainheart plainheart commented Dec 1, 2020

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

1) fix charts cannot be exported when using SVG renderer in IE.

2) fix exported SVG file cannot be opened when using external images.
See #13655

After this fix, exporting SVG file can even be supported in IE 9.

Fixed issues

Details

Before: What was the problem?

After: How is it fixed in this PR?

Usage

Are there any API changes?

  • The API has been changed.

Related test cases or examples to use the new APIs

Please refer to test/ie-svg-export.html.

Others

Merging options

  • Please squash the commits into a single one when merge.

Other information

Related PR in zrender ecomfe/zrender#673

@plainheart plainheart added this to the 5.1.0 milestone Dec 1, 2020
@echarts-bot
Copy link

echarts-bot bot commented Dec 1, 2020

Thanks for your contribution!
The community will review it ASAP. In the meanwhile, please checkout the coding standard and Wiki about How to make a pull request.

The pull request is marked to be PR: author is committer because you are a committer of this project.

@pissang
Copy link
Contributor

pissang commented Dec 14, 2020

Also I'm not sure if we should remove the edge condition here https://github.com/apache/incubator-echarts/blob/a3a0e4582b59dd974d349eef8dfde2b6ebe229ab/src/component/toolbox/feature/SaveAsImage.ts#L61 since edge is using chromium now

@pissang pissang modified the milestones: 5.1.0, 5.0.1 Dec 14, 2020
@plainheart
Copy link
Member Author

plainheart commented Dec 14, 2020

I'm not sure if we should remove the edge condition here. edge is using chromium now

@pissang I think we may need to tweak the logic of checking if the browser is Edge in zrender.
Before using chromium core, the latest version of Edge is 18.x(EdgeHTML core version). Now it's increasing from 78.x(Edge Browser Version).

Changes in zrender would be:

// https://github.com/ecomfe/zrender/blob/master/src/core/env.ts#L58
- const edge = ua.match(/Edge\/([\d.]+)/);
+ const edge = ua.match(/Edge?\/([\d.]+)/); // make `e` optional to match new edge with chromium core.

Old UserAgent

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.18363

New UserAgent

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36 Edg/87.0.664.60

Related commit in zrender is ecomfe/zrender@d53d616

So, the judgment here should be:

// Chrome, Firefox, New Edge
if (typeof MouseEvent === 'function' && (env.browser.newEdge || (!env.browser.ie && !env.browser.edge))) {

The related commit is 177f1fc

@pissang
Copy link
Contributor

pissang commented Dec 15, 2020

I think it looks good to me. Pin @100pah to have a further check.

@100pah
Copy link
Member

100pah commented Dec 18, 2020

It looks good to me. @plainheart

@pissang pissang merged commit eb9341c into master Dec 18, 2020
@echarts-bot
Copy link

echarts-bot bot commented Dec 18, 2020

Congratulations! Your PR has been merged. Thanks for your contribution! 👍

@pissang pissang deleted the fix-svg-export branch December 18, 2020 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

svg image save bug on svg render with external symbol image
3 participants