KoolReport's Forum

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

Want to display selected value of donut chart #666

Open Naga Jothi opened this topic on on Feb 11, 2019 - 3 comments

Naga Jothi commented on Feb 11, 2019

Hi,

I need to display the selected value of a donut chart.I am using codeigniter.I have written the code and got nothing in response.

DonutChart::create(array(
    "responsive"=>true,
    "dataSource"=>$orders,
    "columns"=>array(
        "type",
        "amount"=>array(
            "type"=>"number",
            "prefix"=>"$",
        )
    ),
    "clientEvents"=>array(
            "itemSelect"=>"function(params){
                console.log('click', params.selectedValue);
            }",
    )
)); 

No data is displayed in console.I need the selected value of the chart.Please help me.I need this urgently.

KoolReport commented on Feb 12, 2019

You change to rowSelect and try to console.log(params) to see if it works.

Naga Jothi commented on Feb 24, 2019

Hi,

Thank You so much for the solution.I have solved that problem. But I am facing problem in export to pdf.I am using codeigniter and calling the reports from controller.

I need to export the chart in to pdf and I have used instant exporter function to export.But it gives empty pdf.

Here are the functions,

public function get_cash_detail_by_date()
	{
		
		if (!$this->ion_auth->logged_in()){
			redirect('authentication/login', 'refresh');
		}

		$top_url_menu = str_replace(array("_","-"), ' ', strtolower($this->uri->segment(1)));
		$left_url_menu = $this->input->get('id');

		if(!$this->role_model->create_role_permission($top_url_menu, $left_url_menu, 'rr_update')){
			$this->session->set_flashdata('check_permission', 'You do not have permission to edit attribute');
			redirect($this->uri->segment(1) . '/'. $left_url_menu . "?menu=".$this->input->get('menu').($this->input->get('submenu')? "&submenu=".$this->input->get('submenu') : "" )."&id=".$this->input->get('id')."&dbc=1");
			return false;
		}


			unset($_SESSION["from"]);
			unset($_SESSION["to"]);
			unset($_SESSION["type"]);
			
			$from = $this->input->post('from')?$this->input->post('from'):date('Y-m-d');
			$to = $this->input->post('to')?$this->input->post('to'):date('Y-m-d');
			$type = $this->input->post('type');
			$_SESSION['from']=$from;
			$_SESSION['to']=$to;

			$from = $_SESSION['from'];
			$to = $_SESSION['to'];
			
			$values = $this->reports_model->get_cash_detail_by_date($from, $to, $type);

		//  $_SESSION['values']=$values;
		 
			$data = array(
				'title' 		=>	'Cash Report',
				'page_name' 	=>	'reports/cash_reportpdf',
				'top_menus' 	=> 	$this->menu_model->top_menu(),
				'topmenu_roles'	=> 	$this->role_model->get_user_role_for_topmenu(),
				'all_clients'	=> 	$this->user_model->client_detail(),
				'all_stores'	=> 	$this->user_model->get_all_store_details(),
				'user_roles'	=> 	$this->role_model->user_roles_detail(),
				'stores'		=>	$this->user_model->get_store_detail(),
				'menus' 		=>	$this->menu_model->menus($this->uri->segment(1)),
				'roles' 		=>	$this->role_model->get_user_role(),
				'orders1' 		=> $values
			 );

		$this->load->view('index', $data);	
			
			
	}

This is the function to display the chart in view page.

public function export(){
		
		Exporter::export($_SERVER['DOCUMENT_ROOT']."/client/clienttool/application/views/pages/reports/cash_report.php")
		->pdf(array(
			"format"=>"A4",
			"orientation"=>"portrait"
		))
		->toBrowser("myfile.pdf");
	}

This is the export function.

Can you please tell me how to achieve export to pdf option in codeigniter? Please reply me asap.

Thank You.

Naga Jothi commented on Feb 24, 2019

And there is another issue , I am trying to add link to the values of table.But it is not showing as link,it is just displaying the a href text insted.

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

CodeIgniter