ColumnMeta
Introduction #
ColumnMeta
is a process to alter your data meta information such as "label", "type", "prefix", "suffix" for all kinds of data, "decimals", "decimalPoint", "thousandSeparator" for numeric data, or "format", "displayFormat" for datetime data.
Example #
<?php
class MyReport extends \koolreport\KoolReport
{
public function setup()
{
...
->pipe(new \koolreport\processes\ColumnMeta(array(
"productName" => array(
"label" => "Product",
"type" => "string",
"prefix" => "prefix_",
"suffix" => "_suffix",
),
"dollar_sales" => array(
"type" => "number",
"decimals" => 2,
"decimalPoint" => ".",
"thousandSeparator" => ",",
),
"orderDate" => array(
"type" => "datetime",
"format" => "Y-m-d H:i:s",
"displayFormat" => "Y-m-d"
)
)))
...
}
}
Code explanation:
In the above example, we change "productName" column's meta to string type, "dollar_sales"'s to numeric one, and "orderDate"'s to datetime one.
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.