Using Frappe Charts in Print Format

Hi,

I’d like to use Frappe Charts (Frappe Charts: Simple and Modern SVG Charts) in my print format.

For a trial-and-error approach, I copied the script from https://discuss.frappe.io/t/load-a-javascript-in-print/16518. which worked fine when viewing the print in full-page mode. The regular preview and the PDF does not work.

I run Frappe Framework: v13.14.0 (version-13) in development mode.

Is there any guide to run custom javascript for print formats? Is storing the “resulting” HTML from a custom script into a DocType field the only way to run Javascript in the PDF preview?

Best regards
Simon

1 Like

I have the same problem and tried to solve the same way. Also unsuccessfully in this attempt.

Maybe this link will help you.

https://frappeframework.com/docs/v13/user/en/guides/portal-development/context

I am almost getting it, I put it for the Chart to load after the DOM loads and at least now it appears, but I want to find a way to disable the animation because it is apparently what causes the lines to be below.

document.addEventListener('DOMContentLoaded', function(){ 
    // your code goes here
}, false);

image

I don’t think this can work as Charts are loaded with Client Side.