In the samples documentation, I have tried:
- "Sales by Quarter" sample which uses Google Column Chart class,
- "Sales by Country" sample which uses Google Pie Chart class and I am getting "Cannot read property 'isHtml' of null To use Koolreport library, I have the sentence: require_once "../../../koolreport/core/autoload.php"; Although the ..'widgets\koolphp\Table class is working fine. What am I doing wrong?
For instance, for the Sales by Quarter example, these are the scripts:
----------------------------------------------------------------
SalesByQuarter.php
----------------------------------------------------------------
// Require autoload.php from koolreport library
require_once "../../../koolreport/core/autoload.php";
//Specify some data processes that will be used to process
use \koolreport\processes\TimeBucket;
use \koolreport\processes\Group;
use \koolreport\processes\Sort;
//use \koolreport\processes\Limit;
//Define the class
class SalesByQuarter extends \koolreport\KoolReport
{
use \koolreport\clients\Bootstrap;
protected function settings()
{
// Define "sales" data source with mysql data base source
return array(
"dataSources"=>array(
"sales"=>array(
"connectionString"=>"mysql:host=localhost;dbname=automaker",
"username"=>"root",
"password"=>"votive3102",
"charset"=>"utf8"
),
)
); }
public function setup()
{
$this->src('sales')
->query("
SELECT
orders.orderDate,
sum(orderdetails.quantityOrdered * orderdetails.priceEach) as sales
FROM
orders
Inner Join orderdetails ON orderdetails.orderNumber = orders.orderNumber
Group by orders.orderDate
Order by orders.orderDate
")
->pipe(new TimeBucket(array(
"orderDate"=>array(
"bucket"=>"quarter"
)
)))
->pipe($this->dataStore('sales_by_quarter'));
}
}
----------------------------------------------------------------
SalesByQuarter.view.php
----------------------------------------------------------------
<?php
/* SalesByQuarter.view.php
*/
use \koolreport\widgets\google\ColumnChart;
use \koolreport\widgets\koolphp\Table;
?>
<html>
<head>
<title>Quarter Sale Report</title>
</head>
<body>
<?php
ColumnChart::create(array(
"dataStore"=>$this->dataStore("sales_by_quarter")
));
?>
</body>
</html>