getting error to get data in arrayToDataTable cannot ? google chart is not loading is there any other error

//google.charts.load(‘current’, { ‘packages’: [‘corechart’] });
//google.charts.setOnLoadCallback(displayDonut());

var displayDonut = function () {
var elementId = ”;
var inputData = [];
$(‘.donutChart’).each(function (i, value) {
elementId = value.getAttribute(‘id’);
$.ajax({
url: “/Home/getChartData”,
dataType: “json”,

type: “GET”,
contentType: “application/json; charset=utf-8”,
success: function (response) {
if (inputData.length <= 0) {
inputData.push([“Task”, “Hours”]);
}
$.each(response, function (key, value) {
inputData.push([value.Task, value.Hours]);

});

//console.log(inputData);
var options = {
‘title’: ”,
‘pieHole’: 0.7,
colors: [‘#FA0A0A’, ‘#FBD900’, ‘#ABA2A2’],
pieSliceText: ‘none’,
legend: ‘none’
};
var dataChart =new google.visualization.arrayToDataTable(inputData);

var chart = new google.visualization.PieChart(document.getElementById(id));
chart.draw(dataChart, options);

}
});

});
};

google.charts.load(‘current’, { ‘packages’: [‘corechart’] });
google.charts.setOnLoadCallback(displayDonut());

error:
customchart.js:32 Uncaught TypeError: Cannot read property ‘arrayToDataTable’ of undefined
at Object.success (customchart.js:32)
at c (jquery.min.js:2)
at Object.fireWith [as resolveWith] (jquery.min.js:2)
at l (jquery.min.js:2)
at XMLHttpRequest.<anonymous> (jquery.min.js:2)

Read more here:: getting error to get data in arrayToDataTable cannot ? google chart is not loading is there any other error

Leave a Reply

Your email address will not be published. Required fields are marked *