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

Create the functionality save to svg #2

Open
ThomAub opened this issue Dec 6, 2019 · 11 comments
Open

Create the functionality save to svg #2

ThomAub opened this issue Dec 6, 2019 · 11 comments
Assignees
Labels
enhancement New feature or request

Comments

@ThomAub
Copy link
Contributor

ThomAub commented Dec 6, 2019

In order to save the chart render one can use web browser opened and click on save pngor save svg.
in the Altair documentation they use selenium to bypass the manual part and save directly.
It would be nice to have this feature also. see here for altair documentation

A selenium crate seems to exist and thus the same technic could be used : selenium-rs

@davidB
Copy link
Member

davidB commented Dec 7, 2019

  • this features could be moved as part of in procyon crate (higher level), or showata
  • https://crates.io/crates/fantoccini should also be evaluated as an alternative to selenium
  • every webdriver will use lot of dependencies

@ThomAub
Copy link
Contributor Author

ThomAub commented Dec 8, 2019

  • I agree.
  • I will look into it !
  • Yes we will make sure this is not the default behaviour but imho it's still a nice feature to have.

@ThomAub
Copy link
Contributor Author

ThomAub commented Dec 16, 2019

Just to keep track : https://github.com/jakevdp/altair_savechart

@ChristianBeilschmidt
Copy link

@ThomAub did you try out selenium and maybe have an example of how to do it?
Is it performance-wise a good idea to render the plots this way?

@ThomAub
Copy link
Contributor Author

ThomAub commented Feb 21, 2020

Hello @ChristianBeilschmidt ,

Thanks for your interest ! Unfortunately I didn't put much effort into the selenium option. As you pointed out it's not a great idea performance-wise but it's currently the only solution I found. If I find some times in the coming days to do a complete example I will update this issue.

@ThomAub ThomAub self-assigned this Feb 21, 2020
@ThomAub
Copy link
Contributor Author

ThomAub commented Mar 1, 2020

Hello,
I have made good progress on this issue. I can use fantoccini and geckodriver, still need to implement it for to automatically save the current chart to an svg or png file. I still need to polish the API of this render_and_save function and will publish it to procyon. The procyon crate will be a high level wrapper arround the vega_lite_3 and vega_lite_4 crate thus it will be more appropriate to publish it there.

@ThomAub ThomAub transferred this issue from procyon-rs/vega_lite_3.rs Mar 1, 2020
@ThomAub ThomAub added the enhancement New feature or request label Mar 1, 2020
@ChristianBeilschmidt
Copy link

That sounds great 👍. I guess it makes sense to put it into a common crate rather than to duplicate functionality. I'm looking forward to using it.

So you basically use a headless Firefox for rendering the charts and returning the SVG? Is there a way to keep the browser instance open? I'm not quite sure what the performance penalties are for starting the process over again.

@ThomAub
Copy link
Contributor Author

ThomAub commented Mar 2, 2020

So you basically use a headless Firefox for rendering the charts and returning the SVG?

Yes that's exactly it.

Is there a way to keep the browser instance open?

Yes it's possible this mean that you want to save multiple charts ?

@ChristianBeilschmidt
Copy link

ChristianBeilschmidt commented Mar 2, 2020

Is there a way to keep the browser instance open?

Yes it's possible this mean that you want to save multiple charts?

Yeah, I plan to investigate it for a server process. For histograms, it is good to transfer it to a client browser and have an interactive plot but for scatter plots with lots of points you not necessarily want to transfer all data to the client.

@ChristianBeilschmidt
Copy link

Did you manage to make some progress on this issue or maybe push your current state to a public branch?

@ThomAub
Copy link
Contributor Author

ThomAub commented Apr 26, 2020

Hello,
Yes i managed to have something even if it's a bit ugly .. I will ask for review of another contributor and push it to a public branch in the following days.

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

No branches or pull requests

3 participants