Hi Koolreport Team, thank you so much for your support. I'm getting data grid, but data can't be displayed in chart format. I'm trying for this graphical images from last 2 weeks. Please Please Please Please .... help me out. Here I' attaching my code and output. I want graphical image. Please give me the guideline. I'm KoolReport Pro user...
SalesByCustomer.view.php
<?php
use \koolreport\widgets\koolphp\Table;
use \koolreport\widgets\google\BarChart;
?>
<div class="text-center">
<h1>Sales Report</h1>
<h4>This report shows top 10 sales by customer</h4>
</div>
<hr/>
<?php
BarChart::create(array(
"dataStore"=>$this->dataStore('sales_by_customer'),
"width"=>"100%",
"height"=>"500px",
"columns"=>array(
"customerName"=>array(
"label"=>"Customer"
),
"dollar_sales"=>array(
"type"=>"number",
"label"=>"Amount",
"prefix"=>"$",
)
),
"options"=>array(
"title"=>"Sales By Customer"
)
));
?>
<?php
Table::create(array(
"dataStore"=>$this->dataStore('sales_by_customer'),
"columns"=>array(
"customerName"=>array(
"label"=>"Customer"
),
"dollar_sales"=>array(
"type"=>"number",
"label"=>"Amount",
"prefix"=>"$",
)
),
"cssClass"=>array(
"table"=>"table table-hover table-bordered"
)
));
?>
SalesByCustomer.php
<?php
include APPPATH. "libraries\koolreport\core\autoload.php";
use \koolreport\processes\Group;
use \koolreport\processes\Sort;
use \koolreport\processes\Limit;
class SalesByCustomer extends \koolreport\KoolReport
{
public function settings()
{
return array(
"dataSources"=>array(
"sales"=>array(
"connectionString"=>"sqlsrv:Server=localhost;Database=Demo",
"username"=>"sa",
"password"=>"sa1234",
"charset"=>"utf8"
)
)
);
}
public function setup()
{
$this->src('sales')
->query("SELECT customerName,dollar_sales FROM Sales_by_Customer")
->pipe(new Group(array(
"by"=>"customerName",
"sum"=>"dollar_sales"
)))
->pipe(new Sort(array(
"dollar_sales"=>"desc"
)))
->pipe(new Limit(array(10)))
->pipe($this->dataStore('sales_by_customer'));
}
}
OUTPUT
Sales Report
This report shows top 10 sales by customer
Customer Amount
Baane Mini Imports $25,290
Vitachrome Inc. $5,494
It gives me empty output.... Please help me, because here I'm the only PHP(Koolreport) developer in my organization, Please help me urgently. Today I have to finish this task....