MultiView

Overview #

MultiView has another name called drill-through report. It let you see the same data but in different angles, different charts so that you can understand data better. In MultiView we setup several views, each view holds a different chart. All the views shares the same datasource.

Example #

<?php
    MultiView::create(array(
        "name"=>"multiviewer",
        "dataSource"=>$this->dataStore("data"),
        "views"=>array(
            array(
                "handler"=>"<i class='fa fa-bar-chart'></i>",
                "widget"=>array(BarChart::class,array(
                    "name"=>"mychart",
                    "columns"=>array("year","amount")
                ))
            ),
            array(
                "handler"=>"<i class='fa fa-table'></i>",
                "widget"=>array(Table::class,array(
                    "columns"=>array("year","amount")
                ))
            ), 
        ),
    ));
    ?>           

As we can see in the example, we setup a MultiView called multiviewer with a datasource. We setup two views, one holds a BarChart and another one holds a Table. User can switch between the between views by using the handler.

Properties #

nametypedefaultdescription
namestring*Required Name of the MultiView
titlestringThe title of MultiView that will appears on the top
templatestring"panel"Set the template of the MultiView, default value is "panel".
optionsarrayHolding the options available to specific template, please see more details at options properties.
viewsarrayAn array of views and its settings, each views will have handler and widget property. The handler will hold the text of handler and the widget define which widget to show in the view together with its settings. Please see above example.
clientEventsarrayRegister client events, please view Client Events for more details

Client events #

DrillDown support following events:

namedescription
changingFired when multiview is going to change view. Return false to cancel action.
changedFired when multiview changed index

Example

<?php
MultiView::create(array(
    ...
    "clientEvents"=>array(
        "changing"=>"function(params){
            return false;//Cancel action
        }",
        "changed"=>"function(params){
            console.log('Change to'+params.index);
        }",
    );
));
?>

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.