谷歌图表错误:b.L 不是函数

2021-12-25 00:00:00 charts php javascript html

我使用 Google API 制作了一个包含 3 个图形的小页面.

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

一切正常.然而,从一个时刻到另一个崩溃.

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

在该位置的图表中出现此消息:bL 不是函数

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

有人可以向我解释为什么会发生这种情况吗?

Does someone can explain to me why this happens?

我的例子工作:

<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>

这就是它的工作方式.

从一个时刻到另一个时刻都是如此.

From one moment to the other was so.

推荐答案

感谢大家的回复.

我改了

<script type="text/javascript" src="https://www.google.com/jsapi"></script>

为此:

<script type="text/javascript" src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1.1','packages':['corechart']}]}"></script>

它对我来说很好.

很奇怪,但事实是它确实有效.

Is very strange, but the truth is that it was working.

相关文章