The above example shows you how to create GeoChart
using built-in Google Charts. GeoChart like any KoolReport's widget supports dataSource from DataStore, Process, DataSource or even from array.
<?php
require_once "../../../load.koolreport.php";
require_once "MyReport.php";
$report = new MyReport;
$report->run()->render();
<?php
require_once "../../../load.koolreport.php";
use \koolreport\processes\Custom;
class MyReport extends \koolreport\KoolReport
{
protected function settings()
{
return array(
"dataSources"=>array(
"population2016"=>array(
"class"=>'\koolreport\datasources\CSVDataSource',
'filePath'=>dirname(__FILE__)."/../../../databases/population2016.csv",
"fieldSeparator"=>";"
)
)
);
}
protected function setup()
{
$this->src("population2016")
->pipe($this->dataStore("population2016"));
}
}
<?php
use \koolreport\widgets\google\GeoChart;
?>
<div class="report-container">
<div class="text-center">
<h1>GeoChart</h1>
<p class="lead">
The example show how to use GeoChart <br/> Below is the world polulation in year 2016
</p>
</div>
<div style="margin-bottom:50px;">
<?php
GeoChart::create(array(
"title"=>"World Polulation 2016",
"dataSource"=>$this->dataStore("population2016"),
"columns"=>array(
"Country Name",
"Value"=>array(
"type"=>"number",
"label"=>"Polulation 2016"
)
),
));
?>
</div>
</div>