Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
google pie chart not working every thing is fine
arravalues return the value also good
but design not displayed

What I have tried:

<script type="text/javascript">

// VISUALIZATION API AND THE PIE CHART PACKAGE.
google.load("visualization", "1", { packages: ["corechart"] });

google.setOnLoadCallback(createPIE);

var s = "FFFF";
function createPIE() {
var options = {
title: 'Downtime Analysis',
colors: ['#888', 'orange'],
is3D: true
};
// var liste = document.getElementById('#ddlsec');
// var selectedVal = $('#ddlsec').val();
// alert(selectedVal);
var obj = {};
obj.sec = $.trim($("[id*=ddlsec]").val());
obj.mac = $.trim($("[id*=ddlmac]").val());
obj.from = $.trim($("[id*=txtFromDate]").val());
obj.to = $.trim($("[id*=txtto]").val());
//alert($.trim($("[id*=ddlsec]").val()));
// alert(obj.sec);
$.ajax({
type: "POST",
url: "webmethod.aspx/GetpieChartweb",
data: JSON.stringify(obj),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(jsonData) {
var data = new google.visualization.DataTable();

var arrValues = [['Text', 'Value']]; // DEFINE AN ARRAY.
var iCnt = 0;
// // assumes "word" is a string and "count" is a number
// data.addColumn('string', 'Text');
// data.addColumn('number', 'dep');
$.each(jsonData.d, function() {
arrValues.push([jsonData.d[iCnt].Text, jsonData.d[iCnt].Value]);
iCnt += 1;
//alert(jsonData.d[iCnt].Value);
});
var figures = google.visualization.arrayToDataTable(arrValues);
alert(arrValues);

// THE TYPE OF CHART (PieChart IN THIS EXAMPLE).
var chart = new google.visualization.PieChart(document.getElementById('divpiechart'));

chart.draw(figures, options);
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert('Got an Error');
}
});
}
</script>
Posted
Updated 3-Aug-16 6:51am
Comments
Richard Deeming 3-Aug-16 9:58am    
REPOST
This is now your THIRD copy of the same question:
http://www.codeproject.com/Questions/1116161/Google-pie-chart-not-working-using-webmethod[^]
http://www.codeproject.com/Questions/1116280/Google-pie-chart-not-working-for-me[^]

If you want to update your question, go to the original copy of the question and click "Improve question". DO NOT post your update as a new question!
Nethaji chennai 5-Aug-16 7:17am    
thankyou

1 solution

Quote:
Google pie chart not working every thing is fine
No, it don't work because not everything is fine.

Use the debugger to see what your code is really doing.
Another possibility:
Start with a working sample code and adapt to your needs until you see what you want.
By comparing what this code is doing and what your code is doing, you will see a difference. The difference is probably the problem.

Are you sure it is good to declare an array with these values ?
JavaScript
var arrValues = [['Text', 'Value']]; // DEFINE AN ARRAY.
 
Share this answer
 
Comments
Nethaji chennai 5-Aug-16 7:18am    
now its working fine

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900