Hi, I am using KoolreportPro 5.7.0. Below my code and the result is in the attached image. Thanks.
<?php
use \koolreport\drilldown\DrillDown;
use \koolreport\widgets\google\ColumnChart;
?>
<div class="report-content">
<div class="text-center">
<h1>Distancia Recorrida</h1>
</div>
<?php
require_once __DIR__."/../htmlHeader.php";
DrillDown::create(array(
"yAxis"=>array(
"decimals"=>0,
"decPoint"=>"",
"thousandSep"=>".",
"prefix"=>"",
"suffix"=>""
),
"name"=>"saleDrillDown",
"title"=>"Distancia Recorrida",
"btnBack"=>array("text"=>"Volver"),
"levels"=>array(
array(
"title"=>"Meses",
"content"=>function($params,$scope)
{
ColumnChart::create(array(
"dataSource"=>(
$this->src("default")->query("
SELECT MONTHNAME(BLAH.date) as myDate, CONCAT(MONTHNAME(BLAH.date)) AS myPeriod, BLAH.mySum, SB.name AS entityDescription
FROM(SELECT DATE , companyId, ROUND(SUM(distanceByGps)/1000) AS mySum FROM distanceTraveledMonthly WHERE companyId IN(3) GROUP BY 1,2) BLAH
JOIN cm_sam_db_V2.sam_company SB ON BLAH.companyId = SB.id
")
),
"columns"=>array(
"myPeriod"=>array(
"type"=>"string",
"label"=>"Mes",
),
"mySum"=>array(
"label"=>"Distancia",
"type"=>"number",
'formatValue'=>function($value)
{
return number_format(
$value,
0,
"",
"."
)." kms.";
}
)
),
"clientEvents"=>array(
"itemSelect"=>"function(params){
saleDrillDown.next({year:params.selectedRow[0]});
}",
)
));
}
)
),
"themeBase"=>"bs4",
));
?>
</div>