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

SVG renderer / export #1764

Closed
jarben opened this issue Jul 2, 2015 · 29 comments
Closed

SVG renderer / export #1764

jarben opened this issue Jul 2, 2015 · 29 comments
Assignees

Comments

@jarben
Copy link
Contributor

jarben commented Jul 2, 2015

It's great that ECharts uses ZRender abstraction to draw stuff into canvas. Makes me thinking how hard would it be to render it as SVG? It doesn't need to support animations, the use case is to download a snapshot of what you see into SVG so it can be potentially printed etc.

Is there any in-memory tree of shapes with calculated positions that can be rendered by something else?

@jordansmith42
Copy link

@jarben we are attempting to do something similar and would love SVG support, any update here?

@pissang
Copy link
Contributor

pissang commented Jun 23, 2017

@jordansmith42 We are developing a brand new SVG renderer. It will solve this issue then.

@jarben
Copy link
Contributor Author

jarben commented Jun 23, 2017

This is a great news @pissang, you guys rock!

@jordansmith42
Copy link

That's awesome @pissang, very excited about this. Any idea of a timeline?

@pissang
Copy link
Contributor

pissang commented Jun 24, 2017

@jordansmith42 Not sure yet. It probably will take much more time than we think to do testing.

@Ovilia
Copy link
Contributor

Ovilia commented Aug 15, 2017

We are now preparing the SVG rendering and export work and we'd like to hear @jarben @jordansmith42 if you have any application scenarios that may help us better understand this feature. When would you prefer SVG to canvas?

@jarben
Copy link
Contributor Author

jarben commented Aug 15, 2017

Hi Olivia, that's great to hear, one of the most asked scenario is to be able to save graph in vector so it is possible to print it anywhere. Im on holiday now, will write more when i get back. Anyway, great news about the svg rendering!

@kfirdado
Copy link

kfirdado commented Aug 15, 2017 via email

@Ovilia
Copy link
Contributor

Ovilia commented Aug 15, 2017

@jarben Have a nice holiday!
And when you're back, it would be very nice of you to tell me more about why using SVG for printing is better, since I believe you may also make a large enough canvas (like 2x) to make it?

@Ovilia
Copy link
Contributor

Ovilia commented Aug 15, 2017

@kfirdado That sounds reasonable for me. 😃
Another question is, if ECharts provides an extra method to export charts as PDF file with charts in SVG format inside, would it be helpful to you in this case?
Or it happens more often that you need to add some extra content in the PDF, in which case exporting charts as PDF may not be very helpful?

@kfirdado
Copy link

kfirdado commented Aug 15, 2017 via email

@Ovilia
Copy link
Contributor

Ovilia commented Aug 15, 2017

@kfirdado Thanks! That's very helpful.

@jordansmith42
Copy link

Our use case is almost the same as @kfirdado, we're rendering charts into reports with other types of items which will likely be printed to PDF and likely to paper. Currently using canvas to achieve any reasonable resolution we're forced to bump DPI resulting in a very heavy file size or do what we're currently doing, use another library that sits on top of canvas and rerenders as an svg.

@Ovilia
Copy link
Contributor

Ovilia commented Aug 16, 2017

@jordansmith42 Thanks for that! 😄

@jonavila
Copy link
Contributor

+1 for SVG option. Would be interested to see if there's a way to specify a custom class name to the graphics drawn. I guess that way we could style certain parts of the chart with CSS. Just today I was running the SVG tests in zrender 😍

@Ovilia
Copy link
Contributor

Ovilia commented Aug 17, 2017

@psumstr Thanks for your suggestion. Although we may not provide class name for users to use CSS to change certain parts of the chart, since this may interfere with the chart rendering and cause potential problems.

@jonavila
Copy link
Contributor

@Ovilia Thanks for the quick reply. Yeah, I haven't thought of the full implications of adding classes to chart elements, but AMCharts does something like this:
https://www.amcharts.com/kbase/css-class-names/
https://www.amcharts.com/kbase/css-animations/

SVG rendering may also allow for future accessibility requirements (screen reader compatibility). Looking forward to all the future improvements.

@Ovilia
Copy link
Contributor

Ovilia commented Aug 17, 2017

@psumstr Thanks for your advice. We will consider them when making our SVG version. 😄

@jarben
Copy link
Contributor Author

jarben commented Aug 21, 2017

Hi @Ovilia , regarding the printable size, similarly to what @jordansmith42 has mentioned, vector is much smaller and suitable for PDFs. Also, SVG is easily editable which is great for using ECharts inside infographics.

Also agree with @psumstr around using CSS to customize charts. There might be some implications but's that's same as any widget library in HTML isn't it?

Anyway, thanks again for asking and working on this, it's such a good news!

@Ovilia
Copy link
Contributor

Ovilia commented Aug 21, 2017

@jarben We will consider the CSS suggestion. Thank you!

@Mattdjuret
Copy link

Mattdjuret commented Sep 21, 2017

+ 1 for SVG Export. It would be nice if this also can be done programmatically with javascript as we like to export the chart as vector to Powerpoint. @Ovilia

@Ovilia
Copy link
Contributor

Ovilia commented Sep 21, 2017

@Mattdjuret That sounding nice! Thanks for your advice.

@Ovilia Ovilia added the SVG label Nov 10, 2017
@Ovilia
Copy link
Contributor

Ovilia commented Nov 10, 2017

Hey guys, here I'd like to update some information about our work on SVG.
ECharts has just release a beta version of SVG rendering: https://ecomfe.github.io/echarts-doc/public/en/tutorial.html#Render%20by%20Canvas%20or%20SVG

SVG version may be released officially in about two months.
You're welcomed to try it out and send us some feedback, either on use scenarios or features requested.
Thanks!

@jarben
Copy link
Contributor Author

jarben commented Nov 10, 2017

Hi @Ovilia , this is such a great news, will give it a try today!

@jarben
Copy link
Contributor Author

jarben commented Nov 10, 2017

One question @Ovilia, is there any way to save as SVG from a chart that is rendered as canvas? I'm asking because while this SVG painter is in beta, it might be handy to provide SVG export while displaying chart with stable echarts.

Would this require rendering echarts in a hidden DOM element with SVG renderer enabled or is there any way to do this while chart is rendered in canvas?

Also, is there any list of known issues in the SVG painter so that we don't need to create news issues for known issues? I've noticed few issues with maps, animations and resizing. Will submit to the repo but maybe there is already a list of known TODO so we don't need to spend time on providing use cases etc?

Anyway, this is such as milestone, thanks so much for your hard work!

@Ovilia
Copy link
Contributor

Ovilia commented Nov 11, 2017

Hi @jarben , thanks for trying out!

Currently, we provide exporting SVG in toolbox when rendering as SVG. Here's how to do it:

  1. Use 'svg' as renderer when init ECharts;
  2. Add saveAsImage in toolbox;
  3. Click download in toolbox and will download the SVG chart.

We will provide function to export SVG later, other than with toolbox.
Besides that, if you have the need of exporting SVG while rendering as Canvas, please tell me in which cases it is needed.

I will make a TODO list of bugs and improvements of SVG. Thanks for your advice!

Hope you a nice weekend! 😄

@jarben
Copy link
Contributor Author

jarben commented Dec 20, 2017

Hi @Ovilia, sorry it took me ages to report this but here is a list of issues I found: #7332

So great to see charts scalable!

@Ovilia
Copy link
Contributor

Ovilia commented Dec 21, 2017

@jarben Thank you!

@Ovilia
Copy link
Contributor

Ovilia commented Dec 22, 2018

I'm going to close this issue. Please feel free to open another if you find some SVG problems. Thanks all for your support!

@Ovilia Ovilia closed this as completed Dec 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants