Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Chart error: b.L is not a function

I did a little page with 3 graphics using the Google API.

Everything worked perfectly. However from one moment to the other crashed.

In the chart of the place appears this message: bL is not the function

Does someone can explain to me why this happens?

My example working:

<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script>
    google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
     var data = new google.visualization.DataTable();
        data.addColumn('string', 'Date');
        data.addColumn('number', '2015');
        data.addColumn('number', '2014');
        data.addRows([
    ['Jan', 197680, 241921],
    ['Fev', 183619,205572],
    ['Mar', 205643,214666],
    ['Abr', 205643,202097],
    ['Mai', 0,210007],
    ['Jun', 0,202434],
    ['Jul', 0,217502],
    ['Ago', 0,175038],
    ['Set', 0,206510],
    ['Out', 0,209802],
    ['Nov', 0,197122],
    ['Dez', 0,162796]

]);

        var options = {
          title: 'Energia 2014/2015',
          titleTextStyle: {color: 'white', fontSize: '18'},
          chart_M: 'function',
          legend: {textStyle: {color: 'white'}},
          colors: ['#0099FF', '#11334c'],
          backgroundColor: "transparent",
          hAxis: {title: '', 
            textStyle: {
            color: '#C8C8C8' 
            }},
                vAxis: {title: '', 
            textStyle: {
            color: '#C8C8C8' 
            }}

        };

      var chart = new google.visualization.ColumnChart(document.getElementById('chart_energy'));
        chart.draw(data, options);

      }

    </script>

This is how it was working.

enter image description here

From one moment to the other was so.

enter image description here

like image 862
rpirez Avatar asked Mar 17 '23 16:03

rpirez


2 Answers

Your page contains the gauge, line and column charts. So I'm presuming you have calls to google.load("visualization", "1", {packages:["gauge"]}); as well, in addition to google.load("visualization", "1", {packages:["corechart"]});.

The different packages with separate load calls seemed to load fine until yesterday. But for some reason one or more packages aren't loading today which is why I was getting a similar exception.

Changing the separate load calls into one call like google.load("visualization", "1", {packages:["corechart","gauge"]}); should make it work.

like image 63
maverick Avatar answered Mar 28 '23 09:03

maverick


I've got the same problem and it just started happening even though the chart was working earlier.

EDIT: I found that in my case google.load was called multiple times to load two different visualization packages. I've found out that if you load both packages at once it will resolve this error.

like image 33
jb001 Avatar answered Mar 28 '23 09:03

jb001