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 #

nametypedefaultdescription
dataSourcemixedSet the datastore or other forms from which chart will read
columnstringThe column name in datastore from which chart will read
dataarrayDirectly set data for the sparkline chart if you do not want to use the dataStore and column property
widthstring"20px"Set the width of chart
heightstring"20px"Set the height of chart
optionsarraySet 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.