KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Exporting Google Charts on Dashboard #2384

Closed Morgan Smith opened this topic on on Oct 12, 2021 - 21 comments

Morgan Smith commented on Oct 12, 2021

I am trying to get my google charts to show up on the PDF i am exporting using the Client::dashboard("")->exportToPDF(). The dashboard is exported, however the charts do not show up. Is there any suggestions or tips that I can get for this? Let me know what you will need to see to help as well!

KoolReport commented on Oct 14, 2021

May you post some of your code to illustrate. Do you use the LocalExport engine or Chromeheadlessio engine? Do you mean you get the pdf file exported, just that there is no chart on it.

Morgan Smith commented on Oct 14, 2021

I am using the Chromheadlessio engine. When the file exports, it will export tables but it will not export the Charts that were also on the dashboard. The code I am using is

 "Export Dashboard" =>MenuItem::create()
                            ->onClick(
                                Client::showLoader().
                                Client::dashboard("PermitBoard")->exportToPDF()
                                // Client::widget("Graph1")->exportToPDF()
                            )

And the export handler looks like this:

return ExportHandler::create()
                ->storage(dirname(__DIR__)."/storage")
                ->pdfEngine(
                    ChromeHeadlessio::create()
                    ->token("Token")
                );

This is what i want to export:

and this is what is actually being exported:

Morgan Smith commented on Oct 21, 2021

Just checking back in if you guys have gotten anywhere on this?

iWorQ Systems commented on Oct 29, 2021

Can We get an update on this?

KoolReport commented on Nov 1, 2021

Sorry for our late reply to you. I have sent the issue to dev.team to investigate. I will update to you when receiving update from them.

KoolReport commented on Nov 1, 2021

I would like to know if you have use the latest version of KoolReport Pro. There is update of CloudExport package in KoolReport Pro that's important for Dashboard to load resources like css. What I have seen from your export result is the lost of resource file like css. The dev.team said that this issue has been addressed with current version of Dashboard and KoolReport Pro. Please make sure you have used the latest version.

iWorQ Systems commented on Nov 1, 2021

I just checked and we are using 5.7 for Pro and 2.0 for dashboard. which I believe are the latest versions correct?

Sebastian Morales commented on Nov 2, 2021

Would you pls open the file koolreport/cloudexport/composer.json and let us know the require version of "chromeheadlessio/php-client"? Tks,

iWorQ Systems commented on Nov 2, 2021

1.1.0 is the version.

Sebastian Morales commented on Nov 3, 2021

Would you pls change the version to "dev-master", run compose update in koolreport/cloudexport directory then try export again? Tks,

iWorQ Systems commented on Nov 3, 2021

We have updated and the charts are still not showing up.

KoolReport commented on Nov 4, 2021

Just to keep you update that our dev.team is still working to replicate the issue. I will comeback with you with further needed information.

iWorQ Systems commented on Nov 4, 2021

If this helps we are using php 7.2 for our development not 8.0. Let me know if you need any other info.

KoolReport commented on Nov 4, 2021

Thank you very much, that will help. I have told dev.team.

iWorQ Systems commented on Nov 5, 2021

I have also noticed that our CSS is not transferring over with our table could that also cause some issues?

iWorQ Systems commented on Nov 5, 2021

I think that might be whats going on. It is not pulling in the .js files or the .css files. Let me know what you think.

KoolReport commented on Nov 6, 2021

Yes, you are right that the css and js file is not included into the zip package that cloudexport send to chromeheadlessio. The process is that:

  1. We get the dashboard content (or widget) with all necessary css and js.
  2. We give that page to cloudexport.
  3. Cloudexport find all css and get them by get_file_contents()
  4. Then we bundle the html file + all resources (css, js) into zip file and send to chromeheadlessio
  5. ChromeHeadlessio extract and contruct the page again and converting to pdf and send back to your server.
  6. All files are deleted immediately.

The dev.team has not been able to replicate issue but I guess the issue could be at step 3 which cloudexport use local url to get css. It could be issue with security here prevent local php could not access local url (not sure yet).

Could you please send me the url of your dashboard (appear on browser url).

iWorQ Systems commented on Nov 10, 2021

So we found out that the locally hosted page was not loading the css or js. So we moved it to our stage server and now it works!! That being said we did have one more question. Now that our charts are exporting, they are formatted kinda weird. We were just wondering if there was an easy way to get those to look like they do on the Dashboard. Attached is what it looks like now.

KoolReport commented on Nov 11, 2021

It is due boostrap grid system applied to the size of paper, let try this:

Row::create([
    YourMetric::create(),
    YourMetric::create(),
    YourMetric::create(),
])->breakPoint(""),

Let input empty "" into breakPoint. Also try "sm" as well.

Let us know if it works.

iWorQ Systems commented on Nov 11, 2021

That did it thanks!

KoolReport commented on Nov 11, 2021

Awesome :)

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed
solved

Dashboard