KoolReport's Forum

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

Why my dashboard is taking long time to load? #2128

Open Abhishek opened this topic on on Jun 7, 2021 - 11 comments

Abhishek commented on Jun 7, 2021

Dear Team, I have implemented dashboard with one widget (Home).

  1. Implemented two different types of value matric with panels.

  2. One graph.

Now the issue is it is taking a lot of time to load the page and for the selected data also. That is when I am selecting the count of data in one value metric it is taking a lot of time to load the data of selected one.

So cloud please show me a way to make it faster to load the page and data.

Abhishek commented on Jun 7, 2021

Dear Team I have implemented the concept of Caching also but not use. Still it is taking lot of time to load the page and data.

automaker.php

<?php
use \koolreport\dashboard\sources\MySQL;
use \koolreport\dashboard\caching\FileCache;

class AutoMaker extends MySQL
{
	protected function cache()
    {
        return FileCache::create();
    }
	
    protected function connection()
    {
		return [
            "connectionString"=>"mysql:host=". $_SESSION['sqlHost'] .";dbname=". $_SESSION['c_db'] ."",
            "username"=>$_SESSION['sqlUserName'],
            "password"=>$_SESSION['sqlPassword'],
            "charset"=>"utf8"
        ];
    }
	
}

homeboard.php

<?php
use \koolreport\dashboard\containers\Row;
use \koolreport\dashboard\Dashboard;
use \koolreport\dashboard\containers\Panel;

//require_once "patient_main.php"

class HomeBoard extends Dashboard
{

    protected function widgets()
    {
        return [
            Panel::create()->header("Patient Statistics")->sub([
    Row::create([
        inquires::create()->cache("5min"),
        appointments::create()->cache("5min"),
        visits::create()->cache("5min"),
        consultations::create()->cache("5min"),
        registrations::create()->cache("5min"),
        renewals::create()->cache("5min")
    ])
]),
			
			
			Panel::create()->header("Payment Statistics")->sub([
			Row::create([
			    cash::create(),
				card::create(),
                cheque::create(),
            ])
			]),
			
			branchdata::create()
        ];
    }
}
Abhishek commented on Jun 7, 2021

Dear Team, Please provide me the solutions i need to provide this basic page to my client please.

Abhishek commented on Jun 8, 2021

Dear Team, I have an issue with the dashboard is the dashboard is taking a long time to load the page and it is also taking a lot of time to load the selected value in the value metric functions.

Even I have implemented the concept of caching also but not use.

So, cloud please help me in how to speed up the loading.

KoolReport commented on Jun 8, 2021

May I know how large is your table? Could you please post me your query of a value metric here.

Abhishek commented on Jun 8, 2021

Dear Team, Below is the code of the individual class of the value metrics.

class inquires extends Value
{
    protected function dataSource()
    {
        return AutoMaker::table("tblcustomerenquiries");
    }

    protected function fields()
    {
        return [
            Date::create("custCreatedDate"),
            $this->count(
                Number::create("custEnquiryId")
            )
        ];
	
    }
	
}

class appointments extends Value
{
    protected function dataSource()
    {
        return AutoMaker::table("tblconsultation");
    }

    protected function fields()
    {
        return [
            Date::create("appointmentDate"),
            $this->count(
                Number::create("appointmentDate")
            )
        ];
	
    }
	
}

class visits extends Value
{
    protected function dataSource()
    {
        return AutoMaker::table("tblconsultation");
    }

    protected function fields()
    {
        return [
            Date::create("visitedDate"),
            $this->count(
                Number::create("visitedDate")
            )
        ];
	
    }
	
}

class registrations extends Value
{
    protected function dataSource()
    {
        return AutoMaker::table("tblcustomerenquiries");
    }

    protected function fields()
    {
        return [
            Date::create("custRegisteredDate"),
            $this->count(
                Number::create("custRegistrationId")
            )
        ];
	
    }
	
}

class consultations extends Value
{
    protected function dataSource()
    {
        return AutoMaker::table("tblconsultation");
    }

    protected function fields()
    {
        return [
            Date::create("consultDate"),
            $this->count(
                Number::create("consultId")
            )
        ];
	
    }
	
}

class renewals extends Value
{
    protected function dataSource()
    {
		return AutoMaker::table("tblconsultation")
                ->select("consultId")
                ->where("appointmentType",'Renewal'); 
    }

    protected function fields()
    {
        return [
            Date::create("createdate"),
			$this->count(
                Number::create("consultId")
            )
        ];
	
    }
	
}
Abhishek commented on Jun 8, 2021

Dear Team, I have implemented the index.php as below and is that the right way to implement?

Cloud you please verify the code once please.

<?php
//index.php

require_once "vendor/koolreport/core/autoload.php";
require_once "vendor/koolreport_pro-5.0.4/examples/load.koolreport.php";

require_once "App.php";

App::create()->run();
KoolReport commented on Jun 8, 2021

Please remove the

require_once "vendor/koolreport_pro-5.0.4/examples/load.koolreport.php";

How large is your data table? like tblcustomerenquiries table

Abhishek commented on Jun 8, 2021

How large is your data table? like tblcustomerenquiries table 14191 total records

And if remove the above one I am facing with following error

require_once "vendor/koolreport_pro-5.0.4/examples/load.koolreport.php";

KoolReport commented on Jun 8, 2021

I guess you are copy the whole koolreport_pro-5.0.4 to the vendor. If so please use

require_once "vendor/koolreport_pro-5.0.4/koolreport/core/autoload.php";

You do not need "examples" folder. It will make your application bigger unnecessarily.

KoolReport commented on Jun 8, 2021

About the slowing issue, I have not thought of any issues yet so I forwarded to dev.team to further investigate. Hope that they have some idea.

Abhishek commented on Jun 10, 2021

Dear Team, Any update please.

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

Dashboard