Vindaar / ggplotnim

A port of ggplot2 for Nim
https://vindaar.github.io/ggplotnim
MIT License
175 stars 15 forks source link

ggvega save html without WebView? #153

Closed fbpyr closed 1 year ago

fbpyr commented 1 year ago

First of: thank you so much for this awesome lib!! 🙂

With ggvega I saw the possibilities to save a .json or an .html that gets opened in a browser view.

Is there a possibility - I might have missed - to only save .html ?

Currently I use a workaround to only save json and then glue it together with indexHtml, but that seems clunky.

Vindaar commented 1 year ago

Thank you, I'm glad you like it! :)

I just made a small PR to address this and clean that part up a bit & generalize it. It would probably be a good idea to allow handing a custom HTML snippet as well now that I think about it. Now you can also view them in a browser instead of relying on webview by using the backend argument. Your use case should now work, if you add show = false.

Let me know if this is what you had in mind!

Btw, the Vega backend is pretty bare bones still and many things won't work correctly. Pretty soon I'll extend it to make it more compliant with the rest of the functionality though as I personally need it to be able to generate most plots the normal backend can.

fbpyr commented 1 year ago

Awesome, thank you so much! 🚀 🙂 Yes a simple show keyword arg sounds great! And I saw you also pushed a new release - looking forward to drop my hacky workaround.. 😀

Custom html? I actually had not thought about that, but that sounds pretty neat. 👍

Well coming from Python+Altair (which uses vega) it is amazingto have vega available in nim , too! Currently I am using mostly basic features trying to port an existing Python graph workflow.