amcharts3 icon indicating copy to clipboard operation
amcharts3 copied to clipboard

Server side rendering

Open badaa opened this issue 7 years ago • 7 comments

Is there any possibility to generate/pre-render/render a chart on the server side? We have to include a chart (amcharts) in PDF report. It is almost not possible to use another framework to generate same charts on server side, because our client wants to have in the report just what he see on browser. Thanks!

badaa avatar Jun 14 '17 09:06 badaa

Hi there,

While there are no built-in server-side capabilities in amCharts, you can use one of the head-less browsers, like PhantomJS to generate snapshots of charts, or the whole web pages into images or PDF.

He're a tutorial on how you can do so with amCharts and PhantomJS: https://www.amcharts.com/kbase/automate-report-generation-using-phantomjs/

I hope it helps.

martynasma avatar Jun 20 '17 05:06 martynasma

With amCharts being released in version 4.0, is there a better solution for server-side rendering than using PhantomJS?

ssc-hrep3 avatar Jul 19 '18 07:07 ssc-hrep3

Yes ;)

https://www.amcharts.com/docs/v4/tutorials/automating-report-generation-using-puppeteer/

martynasma avatar Jul 19 '18 07:07 martynasma

I downloaded the example at the end of the tutorial, but no pdf gets exported. (no error in console). Is it meant to work out of the box?

hirako2000 avatar Jan 03 '19 12:01 hirako2000

Yes ;)

https://www.amcharts.com/docs/v4/tutorials/automating-report-generation-using-puppeteer/

I followed the above tutorial and it is not working.

ankit-kejriwal avatar Feb 12 '19 09:02 ankit-kejriwal

OK, so it looks like Puppeteer broke something and is no longer working.

We're working on other solutions.

Please bear with us ;)

martynasma avatar Feb 14 '19 06:02 martynasma

It's necessary to set Page.setDownloadBehavior to define where Chrome will save the downloaded file when using Puppeteer. Unfortunately that is no longer working.

PhantomJS is not being supported for some time so the V3 solution is also not ideal at this point.

We came up with a new solution using Selenium Webdriver. Please check this link: https://www.amcharts.com/docs/v4/tutorials/automating-report-generation-using-selenium-webdriver/

darlesson avatar Feb 27 '19 04:02 darlesson