gpt4 book ai didi

javascript - 错误未捕获引用错误 : Morris is not defined

转载 作者:行者123 更新时间:2023-11-30 13:54:20 33 4
gpt4 key购买 nike

我试图暗示 morris.js 但我收到以下错误:

我试着实现了一些教程,这真的很容易,但到目前为止我得到了以下内容

new Morris.Line({
element: 'myfirstchart',
data: [
{ year: '2008', value: 20 },
{ year: '2009', value: 10 },
{ year: '2010', value: 5 },
{ year: '2011', value: 5 },
{ year: '2012', value: 20 }
],
xkey: 'year',
ykeys: ['value'],
labels: ['Value']
});
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
<link rel="stylesheet" href="~/js/morris.css">
<script src="~/js/sweetalert.min.js" charset="utf-8"></script>
</head>
<body>
<div class="container">
<h2>Costos por proyecto</h2>
<hr>
<div class="col-lg-6">
<h2>Costos</h2>
<hr>
<div id="myfirstchart"></div>
</div>
<div class="col-lg-6">
</div>
</div>
<script src="~/js/graficas.js" charset="utf-8"></script>
</body>
</html>

我收到以下错误:

Uncaught ReferenceError: Morris is not defined

最佳答案

你忘了添加一行脚本:

<script src="//cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.1/morris.min.js"></script>

查看入门:https://morrisjs.github.io/morris.js/

关于javascript - 错误未捕获引用错误 : Morris is not defined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57599250/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com