KoolReport's Forum

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

Cannot display the charts in laravel #425

Open christin opened this topic on on Aug 20, 2018 - 4 comments

christin commented on Aug 20, 2018

hi,I followed the example to make my first report but the chart , table.css , table.js seem not to work.here what it look like.

MyReport.view.php

<?php

use \koolreport\widgets\koolphp\Table;
use \koolreport\widgets\google\BarChart;

?>

Sales Report

This report shows top 10 sales by customer


<?php

BarChart::create(array(
    "dataStore"=>$this->dataStore('sales_by_customer'),
    "width"=>"100%",
    "height"=>"500px",
    "columns"=>array(
        "Name"=>array(
            "label"=>"Customer"
        ),
        "dollar"=>array(
            "type"=>"number",
            "label"=>"Amount",
            "prefix"=>"$",
        )
    ),
    "options"=>array(
        "title"=>"Sales By Customer"
    )
));

?>

<?php Table::create(array(

"dataStore"=>$this->dataStore('sales_by_customer'),
    "columns"=>array(
        "Name"=>array(
            "label"=>"Customer"
        ),
        "dollar"=>array(
            "type"=>"number",
            "label"=>"Amount",
            "prefix"=>"$",
        )
    ),
"cssClass"=>array(
    "table"=>"table table-hover table-bordered"
)

)); ?>

David Winterburn commented on Aug 21, 2018

Hi Christin,

Laravel has a public folder where all resources (like css, js files) must be put in. Please try to set the "assets" property in your report's settings like this:

                function settings()
		{
			return array(
				'assets' => array(
					'path' => public_path(),
					'url' => '',
				),
				"dataSources"=>array(
					...
				),
			);
		}

Let us know if this works for you or not. Thanks!

christin commented on Aug 21, 2018

it doesn't work

<?php
//MyReport.php
namespace App\Reports;

use \koolreport\processes\Group;
use \koolreport\processes\Sort;
use \koolreport\processes\Limit;
use \koolreport\processes\CopyColumn;
use \koolreport\processes\OnlyColumn;



class MyReport extends \koolreport\KoolReport
{
    //We leave this blank to demo only
    public function settings()
    {
        return array(

            'assets' => array(
					'path' => public_path(),
					'url' => '',
				),

christin commented on Aug 21, 2018

it works,thanks!

KoolReport commented on Aug 21, 2018

Another option is to download the Laravel package. This package will help to setup the assets folder automatically as well as allow you to use default data connection settings from Laravel. For downloading and detail of how to use Laravel package please go to the link above.

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

Laravel