I need to remove the message when there is no data in my chart

39 views
Skip to first unread message

Misael

unread,
Nov 25, 2020, 11:11:03 PM11/25/20
to Google Visualization API
Hi friends, I have a graph that works perfectly for me, but I have no idea how to remove the message "Data column (s) for axis # 0 cannot be of type string". This message shows it when there is no data, it is a dynamic graph and sometimes it will not have data, so I want to remove that message. I would appreciate your help. 

this is my graph.

<script type="text/javascript">

    google.charts.load("current", {packages:["corechart"]});
    google.charts.setOnLoadCallback(drawChart);
    function drawChart() {
      var data = google.visualization.arrayToDataTable([
       
        ['Nombre de evento', 'Cantidad de asistentes',{ role: "style" } ],
            @foreach ($datasis as $datasistencia)
              ["{{$datasistencia->Nombre}}", {{ $datasistencia->number}}, "#038579"],
        
            @endforeach
        ]);

      var view = new google.visualization.DataView(data);
      view.setColumns([0, 1,
                       { calc: "stringify",
                         sourceColumn: 1,
                         type: "string",
                         role: "annotation" },
                       2]);

      var options = {
        title: "Registro de usuarios que asistirián a los eventos",
        
        bar: {groupWidth: "75%"},
        legend: { position: "none" },
      };
      var chart = new google.visualization.BarChart(document.getElementById("barchart_valuesistencia"));
      chart.draw(view, options);
  }
  </script> 
Reply all
Reply to author
Forward
0 new messages