<apex:page controller="Portalpiecharteyeview">
<apex:outputPanel id="chart_div">
<script type="text/javascript">
google.load("visualization", "1", {packages: ["piechart" ]});
google.setOnLoadCallback(drawPieChart);
var chart;
var data;
function drawPieChart() {
var data = new google.visualization.DataTable( eval( '({!AccountInfo})' ) );
chart = new google.visualization.PieChart(
document.getElementById('{!$Component.chart_div}')
);
chart.draw(data, {width: 500, height: 250,
legend: 'Bottom',
smoothLine: true,
title: 'This is the Account Chart',
is3D: true ,
backgroundColor: {stroke:'none', strokeSize: 0},
});
// alert(' Charrtttt-- > '+chart);
google.visualization.events.addListener(chart, 'select', selectHandler);
PieChart.setSelection(chart.getSelection());
function selectHandler(e) {
alert('The user selecte ' + chart.getSelection()[0].row);
document.getElementById('{!$component.result}').value = data.getValue(chart.getSelection()[0].row,0);
var valParameter = document.getElementById('page:form:valParameter');
valParameter.value = document.getElementById('{!$component.result}').value;
//var buttoncall = document.getElementById('page:form:pgBlock:SectionforChart:BudCall');
//alert(' Button to Call --> '+buttoncall);
//buttoncall.click();
callMyFirstFn();
}
}
function databudget(){
datatoget(
document.getElementById("result").value
);
}
</script>
</apex:outputPanel>
</apex:page>
.....class............
public with sharing class Portalpiecharteyeview {
public String AccountInfo{get; set;}
Public Portalpiecharteyeview()
{
AccountVisible();
}
Public void AccountVisible(){
// AccountInfo = '{cols: [{id: "Col1", label: "Account Name", type: "String"},{id: "Col2", label: "Amount", type: "Integer"}], rows: [{c:[{v: "A"},{v: 10.0}]},{c:[{v: "B"},{v: 20.0}]]}';;
AccountInfo = '{cols: [{id: "Col1", label: "Account Name", type: "String"},{id: "Col2", label: " Amount", type: "Integer"}], rows: [{c:[{v: "A"},{v: 10.0}]},{c:[{v: "B"},{v: 20}]},{c:[{v: "C"},{v: 30.0}]},{c:[{v: "D"},{v: 50.0}]},{c:[{v: "G"},{v: 60}]},{c:[{v: "H."},{v: 40}]},{c:[{v: "I"},{v: 10.0}]},{c:[{v: "K"},{v: 20}]},{c:[{v: "L"},{v: 40}]}]}';
}
}
the thing is now i am getting the selected data when i create the action event for the selected item i am not getting the selected data .how to handle it can u quide me on that