Using puppeteer to create PDFs out of dashboards - issues with legend in Grafana v8


I have been using NodeJS with the puppeteer package to generate PDF renderings of complete dashboards. The full code is available in this GitHub gist.

This has been working fine until I upgraded from v7.3.7 to v8.0.4. Now, the graphs render fine but the legend is not showing the coloured line, as you can see below.

Can anyone think of which change created this issue ? I could modify the NodeJS script and/or the Grafana config.

So, I’m the author of that Gist - but to be honest haven’t worked with it in a while. As I think you realize, all that the script does is spin up a headless browser instance (Chromium), render the dashboard, and “print” it to a PDF.

The first troubleshooting step would probably be to simply load the same dashboard in Chrome, and print it to a PDF - and see if the legend colors display as they should. If they do display fine when you “print” from a browser normally, then there’s probably an issue with what the script itself does - i.e. an option that needs to be tweaked.

If the legend still doesn’t show well when you export it from a normal browser, then there’s some sort of general incompatibility with the way Grafana 8 renders charts. I’m not sure what the best course of action would be in that case. Potentially migrating to the new timeseries panel (assuming that prints well)?

Hello, awesome to meet you here !

The legend is not showing from a browser “print to PDF” (tried Chromium and Firefox) either when using Grafana 8, and the same behaviour occurs with the new Time Series.

For reference, link to the GitHub issue I created.

1 Like

This topic was automatically closed after 365 days. New replies are no longer allowed.