One or more participants failed to draw() + Cannot read property 'Do' of undefined

Viewed 38

This is a Google chart that I worked with by importing data with ajax. The chart that was working fine suddenly pops up and doesn't work. What should I do to solve it? Below is the source I worked on.

One or more participants failed to draw() Cannot read property 'Do' of undefined Errors occur at the same time

What can be done to solve it?

code

  var chartDrowFun = {

        chartDrow : function(){
        var app_tot = new Array();
        var app_mode = $('#app_mode').val();
//      console.log(month);
        $.ajax({
            type    : "POST",
            url     : "app/test.php",
            async   : false,
            data    : {'year' : year, 'month' : month, 'app_mode' : app_mode},
            dataType: "json",
            success : function(response) {              
//              console.log(response);
                app_tot = response;     
                var and_c = app_tot["and_c"];
                var ios_c = app_tot["ios_c"];
//                  console.log(jhs[0]['and_c']);
            }
        });
//      console.log(app_tot);
        var chartData = '';
        //날짜형식 변경하고 싶으시면 이 부분 수정하세요.
        var chartDateformat     = 'yyyy년MM월dd일';
        //라인차트의 라인 수
        var chartLineCount    = app_tot.length;
        //컨트롤러 바 차트의 라인 수
        var controlLineCount    = 0;
        function drawDashboard() {
          var data = new google.visualization.DataTable();
          //그래프에 표시할 컬럼 추가
          data.addColumn('datetime' , '날짜');
          data.addColumn('number'   , 'IOS');
          data.addColumn('number'   , 'ANDROID');
          data.addColumn('number'   , '전체');            
         
          //그래프에 표시할 데이터
          var dataRow = [];
          for(var i = 0; i < app_tot.length; i++){ //랜덤 데이터 생성      
//            console.log(jhs[i]['ios_c']);
            var ios   = getNum(parseFloat(app_tot[i]['ios_c']));
            var and   = getNum(parseFloat(app_tot[i]['and_c']));
            var total   = getNum(ios + and);
            console.log(and);
            dataRow = [new Date(year, month-1, i+1, 0 ), ios, and , total];
            data.addRow(dataRow);
          }
          
            var chart = new google.visualization.ChartWrapper({
              chartType   : 'LineChart',
              containerId : 'lineChartArea', //라인 차트 생성할 영역
              options     : {
                              isStacked   : 'percent',
                              focusTarget : 'category',
                              height          : 500,
                              width           : '100%',
                              legend          : { position: "top", textStyle: {fontSize: 13}},
                              pointSize     : 5,
                              tooltip         : {textStyle : {fontSize:12}, showColorCode : true,trigger: 'both'},
                              hAxis           : {format: chartDateformat, gridlines:{count:chartLineCount,units: {
                                                                  years : {format: ['yyyy년']},
                                                                  months: {format: ['MM월']},
                                                                  days  : {format: ['dd일']},
                                                                  hours : {format: ['HH시']}}
                                                                },textStyle: {fontSize:12}},
                vAxis             : {minValue: 10,viewWindow:{min:0},gridlines:{count:-1},textStyle:{fontSize:12}},
                animation       : {startup: true,duration: 1000,easing: 'in' },
                annotations : {pattern: chartDateformat,
                                textStyle: {
                                fontSize: 15,
                                bold: true,
                                italic: true,
                                color: '#871b47',
                                auraColor: '#d799ae',
                                opacity: 0.8,
                                pattern: chartDateformat
                              }
                            }
              }
            });
            var control = new google.visualization.ControlWrapper({
              controlType: 'ChartRangeFilter',
              containerId: 'controlsArea',  //control bar를 생성할 영역
              options: {
                  ui:{
                        chartType: 'LineChart',
                        chartOptions: {
                        chartArea: {'width': '60%','height' : 80},
                          hAxis: {'baselineColor': 'none', format: chartDateformat, textStyle: {fontSize:12},
                            gridlines:{count:controlLineCount,units: {
                                  years : {format: ['yyyy년']},
                                  months: {format: ['MM월']},
                                  days  : {format: ['dd일']},
                                  hours : {format: ['HH시']}}
                            }}
                        }
                  },
                    filterColumnIndex: 0
                }
            });
            var date_formatter = new google.visualization.DateFormat({ pattern: chartDateformat});
            date_formatter.format(data, 0);
            var dashboard = new google.visualization.Dashboard(document.getElementById('Line_Controls_Chart'));
            window.addEventListener('resize', function() { dashboard.draw(data); }, false); //화면 크기에 따라 그래프 크기 변경
            dashboard.bind([control], [chart]);
            dashboard.draw(data);
        }
          google.charts.setOnLoadCallback(drawDashboard);
      }
    }
    $(document).ready(function(){
      google.charts.load('current', {'packages':['line','controls']});
      chartDrowFun.chartDrow(); //chartDrow() 실행
    });
0 Answers
Related