Bar
Overview #
The Bar
widget, as the name suggested, will create bar chart. Below code will use the column amount
from result
dataStore to create tiny bar chart.
Properties #
name | type | default | description |
---|---|---|---|
dataSource | mixed | Set the datastore or other forms from which chart will read | |
column | string | The column name in datastore from which chart will read | |
data | array | Directly set data for the sparkline chart if you do not want to use the dataStore and column property | |
width | string | "20px" | Set the width of chart |
height | string | "20px" | Set the height of chart |
options | array | Set extra options for chart |
Example:
<?php
Bar::create(array(
"dataStore"=>$this->dataStore("result"),
"column"=>"amount",
))
?>
Set data directly #
<?php
Bar::create(array(
"data"=>array(5,7,5,10,8,12)
));
?>
Set width and height #
<?php
Bar::create(array(
"data"=>array(5,7,5,10,8,12),
"height"=>"50px",
"options"=>array(
"barWidth"=>"50px",
)
));
?>
Set color for bar chart #
<?php
Bar::create(array(
"data"=>array(5,7,5,10,8,12)
"options"=>array(
"barColor"=>"green",
)
));
?>
Get started with KoolReport
KoolReport will help you to construct good php data report by gathering your data from multiple sources, transforming them into valuable insights, and finally visualizing them in stunning charts and graphs.