No Data on sharepoint 2013

18 views
Skip to first unread message

Steffi BABU

unread,
Sep 9, 2015, 7:19:04 AM9/9/15
to Google Visualization API
I'm trying to use goggle chartsapi for data stored in a list in sharepoint 2013 platform. I'm not receiving any error messages but the chat section says -" No Data". i'm hoping this the right platform to put this question. Here is my code:

<script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">

      google.load('visualization', '1.0', {'packages':['corechart']});
 $(document).ready(function() 
    {
GetMyData();
   
   
    });

var dataArray=[[{label: 'Name', id: 'Name', type: 'string'},{label: 'Hours', id: 'Hours', type: 'number'}]];

 
 function drawChart() {

 
var data = google.visualization.arrayToDataTable(dataArray);
     
        var options = {'title':'Utization on portal projects',
                       'width':400,
                       'height':300};


        var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
 
 function  GetMyData() {
  var soapEnv1 = "<soapenv:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'> \
<soapenv:Body> \
<listName>utilization</listName> \
<ViewFields>\
<FieldRef Name='Title' />\
<FieldRef Name='portal' />\
</ViewFields>\
<query><Query> \
<Where><IsNotNull><FieldRef Name='Title' /></IsNotNull></Where>\
</Query></query>\
</GetListItems>\
</soapenv:Body>\
</soapenv:Envelope>";
        
        $.ajax({
            type: "POST",
            dataType: "xml",
            data: soapEnv1,
            complete: processResult1,
            contentType: "text/xml; charset=\"utf-8\""
        });
 
    
    function processResult1(xData1, status1) 
    {   var extract1;
var extract2;
 
        $(xData1.responseXML).find("z\\:row").each(function() 
        {
            extract1 = $(this).attr("ows_Title");
extract2 = $(this).attr("ows_portal");
dataArray.push([extract1,extract2]);
         });
      }
 drawChart();
 }
    </script>
  <div id="chart_div"></div>
Reply all
Reply to author
Forward
0 new messages