As far as I see it, your data object is not defined outside of the drawing function, thus not allowing you to access it in the selectHandler function.
Try defining it outside. In this way, you'll be able to access it inside any function, including the selectHandler. On Thu, Dec 22, 2011 at 6:24 AM, uma pathy <[email protected]> wrote: > <apex:page controller="Portalpiecharteyeview"> > > > <apex:outputPanel id="chart_div"> > <script type="text/javascript" src=" > http://www.google.com/jsapi"></script> > <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 > > On Tue, Dec 20, 2011 at 7:41 PM, asgallant <[email protected]>wrote: > >> Can you post your code? >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Google Visualization API" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/google-visualization-api/-/2gvz6_mSDVEJ. >> To post to this group, send email to >> [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/google-visualization-api?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Google Visualization API" group. > To post to this group, send email to > [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-visualization-api?hl=en. > -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.
