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 -
i'm hoping this the right platform to put this question. Here is my code:
<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() {
<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>