Hello Everybody,

i am using google piechart under YUI tab and it is not working.
nothing gets displayed while the same code runs well if executed
seperately. i am stuck on it why is it happening.
in order to resolve any loading issue i have wired tab index change
event to a handler which again sends request to the datasource and
generate all the data. but still it is not working.

Code:

google.load("visualization", "1", {packages:["corechart"]});
  google.setOnLoadCallback(drawChart);
  function drawChart() {
    var chart_callback = {
      success: function(o){
        try{
          var rtn_obj = YAHOO.lang.JSON.parse(o.responseText);
        }catch(e){
          alert("JSON parse error");
          return;
        }

        var data = new google.visualization.DataTable();
        data.addColumn('string', 'empname');
        data.addColumn('number', 'count');

        var arr = rtn_obj.data_arr;
        var chart_arr = Array();
        var rowarr = Array();

        for(i=0;i<arr.length;i++){
          rowarr.push(arr[i].empname);
          rowarr.push(parseInt(arr[i].count, 10));
          chart_arr.push(rowarr);
          rowarr = Array();
        }
        data.addRows(chart_arr);

        var chart = new
google.visualization.PieChart(document.getElementById('plcmt_chart_div'));
        chart.draw(data, {width: 450, height: 300, title: 'Students
Placed With Various Employers'});
      },
      failure: function(o){
        alert(o.statusText);
      }
    };

    YAHOO.util.Connect.asyncRequest("POST","campusage.php?do=ppc",
chart_callback, "");
  }

  YAHOO.campusage.placmtcharttab.indexchange = function(e){
    if(e.newValue == 2){
      document.getElementById("plcmt_chart_div").style.display =
"block";
      drawChart();
    }
  };

please help me.

-- 
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.

Reply via email to