0

$.ajax({ type: "POST", url: "/Login/GetAllAciveProject", data: '{ CountryId: 1}', contentType: "application/json; charset=utf-8", dataType: "json",成功:函数(r){

                            var data11 = [];
                            var Header = ['Name', 'On Time Projects', { role: 'annotation' }, 'Delayed Projects', { role: 'annotation' }];

                            data11.push(Header);
                            debugger;
                            for (var i = 0; i < r.length; i++) {
                                var temp = [];
                                temp.push(r[i].Name);
                                temp.push(r[i].TotalDays);
                                temp.push("");
                                temp.push(null);
                                temp.push("");                                   
                                data11.push(temp);

                            }

                           // need arry like this --> ['Aarav', 10, '', , ''],

                            debugger;
                            var data = google.visualization.arrayToDataTable(data11);
                            var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
                            chart.draw(data, options);
                        },
                        failure: function (r) {
                            alert(r.d);
                        },
                        error: function (r) {
                            alert(r.d);
                        }
                    });
4

1 回答 1

1

只需将元素定义为未定义:

var arr = ['Aarav', 10, '', undefined, ''];
于 2020-05-04T06:35:39.077 回答