-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Expose "Export to PNG" to @finos/perspective_viewer #2836
Comments
If someone could give me a hint on where to start, I'd also be open to submit a PR... Thanks! |
Can you clarify the use case for this? There is already a prominent button (as you note), and if this were to be added it would still require the entire UI code to be loaded, attached to the DOM and visible to work. |
Thanks for the response @texodus. The use case is for my project https://sql-workbench.com which uses Perspective v3 in a React app. I provide the possibility of passing SQL queries and visualization configuration via the URL, so that users can share their work with others. I‘d like to trigger those generations programatically, e.g. via a cron schedule on a server, that call a specific route only rendering the Graph result instead of the whole page. Also, I could automatically start downloading the Graph as PNG if this would be exposed as API once the rendering is complete, w/o user interaction. Currently the user would need multiple clicks. Additionally, this would also enable browser automation e.g. with Puppeteer. I haven’t found a way to simulate the clicks on the Perspective component to trigger the PNG saving. Thanks for your feedback! |
I have my own use case for this, exporting data in pdf/excel format from perspective viewers. I want the export to respect the viewer config, so the export needs a way to represent plugins like d3fc, png is the easiest way to do this. |
Feature Request
Description of Problem:
I had a look at the current implementation, and as it seems (I'm not a Rust expert), the export as PNG is not exposed to the JavaScript API. Whereas JSON, CSV and Arrow are (e.g. https://docs.rs/perspective-js/latest/perspective_js/struct.View.html#method.to_json).
Ideally, also the export to HTML would be possible. The programatic PNG export would avoid having to do a screenshot of the component if one would like to store it etc.
Potential Solutions:
If possible, add the export to PNG (and HTML) to the JS API.
The text was updated successfully, but these errors were encountered: