The above example shows you how to create ColumnChart
using D3 package. 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.
The example show how to create column chart with data label.
For example:
...
"options" => array(
"data" => array(
...
"labels" => true
),
...
)
<?php
require_once "../../../../load.koolreport.php";
require_once "MyReport.php";
$report = new MyReport;
$report->run();
$report->render();
<?php
class MyReport extends \koolreport\KoolReport
{
}
<h1 class='title'>Data Label</h1>
<?php
$data = [
['data1' => 30, 'data2' => -50, 'data3' => -100],
['data1' => -200, 'data2' => 150, 'data3' => 100],
['data1' => -100, 'data2' => -150, 'data3' => -40],
['data1' => 400, 'data2' => 150, 'data3' => 100],
['data1' => 150, 'data2' => -50, 'data3' => -150],
['data1' => 250, 'data2' => -150, 'data3' => -50]
];
\koolreport\d3\ColumnChart::create(array(
"dataSource" => $data,
"columns" => array(
'data1',
'data2',
'data3'
),
"options" => array(
"data" => array(
"groups" => array(
array(
"data1",
"data2"
)
),
"labels" => true
),
"grid" => array(
"y" => array(
"lines" => array(
array(
"value" => 0
)
)
)
)
)
));