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

[Feature] supports action "saveAsImage" #18121

Closed
TonyYanOnFire opened this issue Dec 29, 2022 · 3 comments
Closed

[Feature] supports action "saveAsImage" #18121

TonyYanOnFire opened this issue Dec 29, 2022 · 3 comments
Labels
en This issue is in English new-feature pending We are not sure about whether this is a bug/new feature.

Comments

@TonyYanOnFire
Copy link

What problem does this feature solve?

Add an action "saveAsImage" for dispatchAction so that you can write code to trigger the saveAsImage event of an echart instance.

What does the proposed API look like?

myChart.dispatchAction({
    type: 'saveAsImage',
    // saveAsImage options
    ...
})
@echarts-bot echarts-bot bot added en This issue is in English pending We are not sure about whether this is a bug/new feature. labels Dec 29, 2022
TonyYanOnFire added a commit to TonyYanOnFire/echarts that referenced this issue Jan 8, 2023
@Ovilia
Copy link
Contributor

Ovilia commented Jan 9, 2023

Can this be done by chart.getDom().toDataURL()?

@TonyYanOnFire
Copy link
Author

You sure can use current APIs like getDataURL and getConnectedDataURL to extract the url and save it as an image, which is exactly what I'm doing in my production codes right now. But from what I see there are at least 2 inconveniences:

  1. I have to somehow extract and maintain the option I use both in defining toolbox.feature.saveAsImage and getDataURL
  2. I have to define my own download method, which has a great chance to have less compatibility compare to the one echarts has already defined

What I wanna do is as simply as trigger the saveAsImage action, and at first I was like "How hard it is? We already have a saveAasImage button here!" . But turns out the work I have to put into is not that simple, to be fair.

@TonyYanOnFire
Copy link
Author

Hey, anyone still interested in this feature? If no official team members reply within 24 hours, I'm gonna close this issue and related PR.

@TonyYanOnFire TonyYanOnFire reopened this Mar 11, 2023
@TonyYanOnFire TonyYanOnFire closed this as not planned Won't fix, can't repro, duplicate, stale Mar 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
en This issue is in English new-feature pending We are not sure about whether this is a bug/new feature.
Projects
None yet
Development

No branches or pull requests

2 participants