<script type="text/javascript"> // VISUALIZATION API AND THE PIE CHART PACKAGE. google.load("visualization", "1", { packages: ["corechart"] }); google.setOnLoadCallback(createPIE); function createPIE() { var options = { title: 'Downtime Analysis', colors: ['#888', 'orange'], is3D: true }; //alert(""); $.ajax({ url: "webmethod.aspx/GetpieChartweb", dataType: "json", type: "POST", contentType: "application/json; charset=utf-8", success: function(jsonData) { var data = new google.visualization.DataTable(); // assumes "word" is a string and "count" is a number data.addColumn('string', 'Text'); data.addColumn('number', 'Value'); // CREATE A DataTable AND ADD THE ARRAY (WITH DATA) IN IT. //var figures = google.visualization.arrayToDataTable(arrValues) // THE TYPE OF CHART (PieChart IN THIS EXAMPLE). // var chart = new google.visualization.PieChart(document.getElementById('divpiechart')); var len = jsonData.d.length; // alert(len); for (var i = 0; i < len; i++) { alert(i); //data.addRow([jsonData[i].Text, jsonData[i].value]); data.addRow([jsonData[i].Text, jsonData[i].Value]); // error in this line //alert([jsonData[i].Text]); this alert not come } var chart = new google.visualization.PieChart(document.getElementById('divpiechart')); chart.draw(data, options); // DRAW GRAPH WITH THE DATA AND OPTIONS. }, error: function(XMLHttpRequest, textStatus, errorThrown) { alert('Got an Error'); } }); } </script>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)