The above example shows you how to create AreaChart
using built-in Google Charts. In this example, for purpose of chart demonstration only, we do use mock-up data from array. As you can see, the KoolReport's widget in general support dataSource could be DataStore, Process, DataSource or even simple array.
For example:
...
"options"=>array(
"isStacked"=>true // 'relative' is 1000% stacked
)
<?php
require_once "../../../../load.koolreport.php";
require_once "MyReport.php";
$report = new MyReport;
$report->run()->render();
<?php
require_once "../../../../load.koolreport.php";
class MyReport extends \koolreport\KoolReport
{
}
<?php
use \koolreport\widgets\google\AreaChart;
$data = [
['Year', 'Sales', 'Expenses'],
['2013', 1000, 400],
['2014', 1170, 460],
['2015', 660, 1120],
['2016', 1030, 540]
];
?>
<div class="report-container">
<div class="text-center">
<h1>Stacked Areas</h1>
</div>
<div style="margin-bottom:50px;">
<?php
AreaChart::create(array(
"dataSource" => $data,
"columns" => array(
'Year',
'Sales',
'Expenses'
),
"options" => array(
"title" => 'Stacked',
"hAxis" => [
"title" => 'Year',
"titleTextStyle" => [
"color" => '#333'
]
],
"vAxis" => ["minValue" => 0],
"isStacked" => true,
"legend" => [
"position" => 'top',
"maxLines" => 3
],
)
));
?>
</div>
<div style="margin-bottom:50px;">
<?php
AreaChart::create(array(
"dataSource" => $data,
"columns" => array(
'Year',
'Sales',
'Expenses'
),
"options" => array(
"title" => '100% Stacked',
"hAxis" => [
"title" => 'Year',
"titleTextStyle" => [
"color" => '#333'
]
],
"vAxis" => ["minValue" => 0],
"isStacked" => "relative",
"legend" => [
"position" => 'top',
"maxLines" => 3
],
)
));
?>
</div>
</div>