Save AnyChart graph in a document

1
Hi,   I’d like to be able to save the graph produced by the AnyChart widget. I have tried using the Print Screen to PDF widget on the app store but it will only capture everything except the graph. Because the AnyChart widget resolves the graph from a JSON input in the screen I don’t know how else I’d do this. If anyone can tell me how to go about this, it would be much appreciated.   Thanks in advance!
asked
3 answers
1

Hi I don't think you can directly with the AnyChart widget.

You could check out the ChartJS widget for it, this has an option to export to base 64. Then you can use it in a document template to create a PDF.

Check out: https://forum.mendix.com/link/questions/90288

answered
1

I believe you can add a config to the Anychart widget which should allow to display a bar where one of the buttons does exactly what you want.

I haven't tried it yet but you can check the documentation for it here:

https://docs.mendix.com/refguide/charts-any-configuration#5-configuration-options

https://plot.ly/javascript/configuration-options/

It shows a couple of examples as well, unfortunately it's all in .js so I'm not quite sure how this translates to .json yet but there might be some examples online (haven't had the time to check it yet but hopefully this already helps). You need to look for the modebar.

answered
0

The described functionality is part of the plotly “modebar”, which can be turned on in the config tab of your anychart widget by adding the following:

"displayModeBar": true

If this is the first time you are editing your config json, make sure to open and close it for this to work.

 

If you don't want to show the full modebar but only allow user to download an image, you can exclude the other modebar buttons as described here: https://plotly-r.com/control-modebar.html.

 

Hope this helps anyone who (like me) was looking for this!

answered