I want to show additional data related to selected chart portion at the bottom of the chart. I am using ajax but I am not able to trigger click event on the chart.
I am using codeigniter and using koolreport Instant package
Widget::create(PieChart::class,array(
"dataSource"=>array(
array("name"=>"Peter","age"=>35),
array("name"=>"Karl","age"=>32),
)
));
I have tried this javascript code but not working. Giving an error of undefined google
var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
function selectHandler()
{
console.log("clicked");
var selectedItem = chart.getSelection()[0];
if (selectedItem)
{
var topping = data.getValue(selectedItem.row, 0);
alert('The user selected ' + topping);
}
}
google.visualization.events.addListener(chart, 'select', selectHandler);
chart.draw(data, options);