admin管理员组文章数量:1405134
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=""></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.
From one moment to the other was so.
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./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.
From one moment to the other was so.
Share Improve this question edited Apr 17, 2015 at 10:34 James 1051 silver badge10 bronze badges asked Apr 17, 2015 at 8:20 rpirezrpirez 4312 gold badges8 silver badges21 bronze badges 1- I get no error in your fiddle – Dustin Hoffner Commented Apr 17, 2015 at 8:31
3 Answers
Reset to default 4Your 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.
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.
Thank you for all reply.
I changed it
<script type="text/javascript" src="https://www.google./jsapi"></script>
to this:
<script type="text/javascript" src="https://www.google./jsapi?autoload={'modules':[{'name':'visualization','version':'1.1','packages':['corechart']}]}"></script>
and it works fine for me.
Is very strange, but the truth is that it was working.
本文标签: javascriptGoogle Chart error bL is not a functionStack Overflow
版权声明:本文标题:javascript - Google Chart error: b.L is not a function - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744886764a2630534.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论