KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Getting Selected value from piechart #316

Open Naga Jothi opened this topic on on Jun 11, 2018 - 9 comments

Naga Jothi commented on Jun 11, 2018

Hi,

I need to get selected value from piechart and display the data regarding that value in datatable.I have displayed the piechart.But I can't get any values by using clientevents.Can you please help me on this problem asap?

KoolReport commented on Jun 11, 2018

I guess you have followed our client events documentation, so could you please send us some code of the piechart.

Naga Jothi commented on Jun 11, 2018

Yes i have followed the above documentation and added this code to my piechart.but don't know how to get the parameter value in php file. "clientEvents"=>array(

        "itemSelect"=>"function(params){
            console.log(params.selectedValue);
        }"
    )
KoolReport commented on Jun 12, 2018

The itemSelect works for chart like ColumnChart and BarChart however for PieChart, we will use the rowSelect.

<?php
PieChart::create([
    "dataStore"=>$this->dataStore("sample"),
    "columns"=>[
        "item",
        "quantity"=>["type"=>"number"],
    ],
    "clientEvents"=>[
        "rowSelect"=>"function(params){
            console.log(params);
        }"
    ]
]);
?>
Naga Jothi commented on Jun 12, 2018

Hi, Thanks for the reply.I have changed to rowselect and now the console log gets the selected row.But I need help to know how to get the selected row array and pass the value to php file.I have two files payment.php and payment.view.php.I need to pass the param value from view file to payment.php to get the record from db.Please help me asap.

KoolReport commented on Jun 12, 2018

When you get selectedRow, you can get the data of that row including the ledend name which is in the index 0 of array. From that name, you can construct url to pass to browser

Naga Jothi commented on Jun 12, 2018

Hi Thank You for the response.Now it works correctly.Thank You for the help.

KoolReport commented on Jun 12, 2018

Great!

sneha narnaware commented on Aug 3, 2018

hi I need I more help ...

$totalReport= array( [tickets_name] => Array

(
    [0] => Early birds
    [1] => Access ticket
    [2] => Attendees Sale
    [3] => GROSS_SALES
)

[tickets_total] => Array

(
    [0] => $110.00 
    [1] => $0.00 
    [2] => $100.00 
    [3] => $110.00 
)

)

$render1 = new EventTotalReport($totalReport); $render1-> run()->render();

class file---

function settings() {

return array(
   "assets"=>array(
       "path"=>"../../../assets",
        "url"=>UPLOAD_PATH."assets",
    ),
    "dataSources"=>array(
       "Total_datasource"=>array(
       "TotalTickets_datasource"=>array(

            "class"=>'\koolreport\datasources\ArrayDataSource',
            "dataFormat"=>"associate",
            "data"=>array( 
        	array( for(int i=0;i<(count($this->params['tickets_name']));i++){
			 "TicketsName"=>,$this->params['tickets_name'][i]
			   }, 
		    for(int i=0;i<(count($this->params['tickets_total']));i++){
		  "Total"=>,$this->params['tickets_total'][i]
					   }
					   ),
					   ),
        ),

))) }

its throws an error ....unexpected for .... is there any way to insert the values....

David Winterburn commented on Aug 10, 2018

Hi sneha narnaware,

Please open a new thread for your separated problem if you don't mind. Thank you a lot!

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed
solved

None