[Chartjs]-Puppeteer with Chart.js

6👍

You need to have Puppeteer wait for the Javascript to execute and render the graph.

You can supply a waitUntil option to page.setContent (doc):

await page.setContent(reuslt, {
    waitUntil: ["load","networkidle0"]
});

Also, you should disable animation on your chart by setting options.animation.duration to 0.

You haven’t shared your HTML/Javascript so I can’t say for sure, but if your Javascript still isn’t executed then you can use waitForFunction to wait until your graph has loaded. See this answer for details.

Leave a comment