Export/Include Charts chart in the Document template

0
We are currently using 'Charts' (open to change for a different tool) to show charts of our data to our users. Now we are extending the functionality with export functions. This include XLS, JSON and PDF. One wish is to include the Charts chart in the item as well (primarily PDF, as JSON isn't compatible and users can create XLS graphs themselves). Therefor we hope that someone has a solution to include the chart (SVG) as an image in a PDF. From my perspective there are three steps necessary: Convert Chart SVG to image Save the image to an Image object Pass the image object dynamically to the PDF   Who can help?
asked
2 answers
1

Hi,

Take a look at ChartJS widget - https://appstore.home.mendix.com/link/app/1712/

It includes a functionality to  export the chart as a base64-encoded image. This you can then use in a pdf.

-Andrej


EDIT: Check in the release notes

The way it works is you connect a string attribute to the widget, and once the widget is rendered this string attribute is set to the base64-encoded image.

 

EDIT 2:

You should be able to get it show in the pdf by wrapping it in an img html tag. Just make sure to set the rendering to XHTML. Alternatively use community commons base64decodeToFile to store it (temporarily) in a persistent object then use this in your pdf.

answered
0

Sander,

You could also look at JFree Charts module - built for this purpose.  It hasn't been updated recently, but may still work.

https://appstore.home.mendix.com/link/app/3011/TimeSeries/JFree-Charts-(.png-images)

Mike

answered