ColumnsSort

Introduction #

ColumnsSort is a process to sort your data pipe's columns by their names or labels. The sort direct could be ascending, descending, or custom comparative function order.

Example #

<?php
class MyReport extends \koolreport\KoolReport
{
    public function setup()
    {
        ...
        ->pipe(new \koolreport\processes\ColumnsSort(array(
            "{name}" => "asc", // possible string values: "asc", "desc"
            // "{label}" => "desc",
            // "{name}"=>function($col1, $col2) { return $col1 < $col2 ? 1 : -1; },
            // "{label}"=>function($label1, $label2) { return $label1 < $label2 ? -1 : 1; },
        )))
        ...
    }
}

Code explanation:

In the above example, we sort data pipe's columns by ascending names or descending labels or custom comparative functions.

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.