-
Notifications
You must be signed in to change notification settings - Fork 27
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
Support writing the HTML to a file #16
Comments
I've been keen to do this myself as well. A few considerations:
|
I think what we're looking at is a way to save it as an image directly. |
@jprobichaud that's an interesting use case. We've had a one-on-one chat with @moonranger a few months ago and his use case was a throw-away dashboard. Think of it as a poor man's Grafana. |
Thanks a lot, this is very appreciated! |
@jprobichaud, I would argue that saving directly as an image in some ways puts requirements at odds with |
I see. Currently, I'm using chart from the command line to generate simple charts to add to wiki pages. I simply right-click on the canvas in the web browser and do "save image" and get the png out (then go through imagemagick to change the transparent background into a solid white background). It's all good, but it would be nice of we could do that in shot. The simplicity of the interface compared to more powerful tools like gnuplot is appealing but the lack of automation to get the non-dynamic "picture" of the graph is a limiting factor. |
@jprobichaud: I'm afraid @szaydel is right about the complexity of adding this image export feature: chart outputs HTML/JS and relies on ChartJS for actually drawing the chart; adding image export would require an entirely separate output framework that would need to be feature-by-feature compatible with ChartJS. It's probably not happening. You could try this instead, though: https://medium.com/@dschnr/using-headless-chrome-as-an-automated-screenshot-tool-4b07dffba79a |
I think realistically unless folks maintaining Chart.js add more robust support to export image data, adding that to |
Agreed, I understand the concerns. I guess then the original intent of this ticket to have the ability to specify the output filename (instead of a random tmp filename) would still be of actuality. |
@jprobichaud: If you are still looking, I pushed a small changeset, which admittedly can use some refinement, with support for writing files to a given path. There is a -filename option, which, given a valid path, i.e. directory needs to exist, and if file exists it will be overwritten, chart data will be placed into the file identified by the path.
You should be able to grab the code here and build it identically to how you build code form this repository. Branch with changeset Let me know if this works for you. I hope it is at least in the ballpark. |
@szaydel Thanks |
Maybe introduce an command line option
-o
or something like that, which is followed by a file path for writing the chart to. It can be super useful for generating a lot of charts using scripts.The text was updated successfully, but these errors were encountered: