ClientEvents
Overview #
All charts of D3
support client events.
\koolreport\d3\ColumnChart::create(array(
"title"=>"Sale Report",
"dataSource"=>array(
array("month"=>"January","sale"=>32000),
array("month"=>"February","sale"=>43000),
array("month"=>"March","sale"=>33000),
array("month"=>"April","sale"=>40000),
array("month"=>"May","sale"=>45000),
),
"columns"=>array(
"month",
"sale"=>array(
"label"=>"Sale Amount",
"type"=>"number",
"prefix"=>"$"
),
),
"clientEvents"=>array(
"itemSelect"=>"function(params){
alert(params.columnName+' = '+params.selectedValue);
}"
)
));
Try to click on the column chart:
itemSelect #
itemSelect
is an event triggered when we click on item of chart. Below are list of parameters. Note that those parameters are available or unavailable depending on chart types.
Name | description |
---|---|
selectedRowIndex | The index of selected row, available in all type of charts |
columnName | The column name of selected item, not available in Pie and Donut |
selectedValue | The value of selected item, available in all chart types |
selectedRow | Containing all data of selected rows, available in all chart types |
selectedX | The x value of selected item, available in Scatter |
selectedY | The y value of selected item, available in Scatter |
selectedRatio | The ratio of selected item, available in Pie and Donut and FunnelChart |
isSummaryColumn | Whether the selected item is summary column, only available in Waterfall |
selectedName | The name of selected item, only available in Waterfall |
selectedLabel | The label of selected item, only available at FunnelChart |
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.