jQuery 给出“$.plot 不是函数”的流程图
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29345524/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Flot charts giving "$.plot is not a function"
提问by Hans de Jong
I am trying out flot charts, but I keep running into this error:
我正在尝试流程图,但我一直遇到这个错误:
TypeError: $.plot is not a function
类型错误:$.plot 不是函数
I imported all needed javascripts before my own functions.
我在自己的函数之前导入了所有需要的 javascripts。
html:
html:
<div class="row">
<div id="monthly_balance" class="col-md-12" style="height: 200px;">
</div>
</div>
js:
js:
<script src="//cdn.jsdelivr.net/jquery/2.1.3/jquery.min.js"></script>
<script src="//cdn.jsdelivr.net/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script src="//cdn.jsdelivr.net/excanvas/r3/excanvas.compiled.js"></script>
<script src="//cdn.jsdelivr.net/jquery.flot/0.8.4/jquery.flot.min.js"></script>
<script type="text/javascript">
$(function () {
var data = [[1, 12], [2, 25], [3, 4]]; //examplelist
var options = {
series: {
lines: { show: true },
points: { show: true }
}
};
$.plot($("#monthly_balance"), data, options)
});
</script>
My js is at the bottom of the page (I tried to put it in the head as well, but kept the same error).
我的 js 位于页面底部(我也尝试将其放在头部,但仍然出现相同的错误)。
采纳答案by meskobalazs
The http://cdn.jsdelivr.net/jquery.flot/0.8.4/jquery.flot.min.js
file is not found on the server, hence the error. Fix the script reference, and it will be fine.
http://cdn.jsdelivr.net/jquery.flot/0.8.4/jquery.flot.min.js
在服务器上找不到该文件,因此出现错误。修复脚本引用,就可以了。
For example: http://cdn.jsdelivr.net/jquery.flot/0.8.3/jquery.flot.min.js
works fine. The 0.8.4 version is currently missing from the CDN.
例如:http://cdn.jsdelivr.net/jquery.flot/0.8.3/jquery.flot.min.js
工作正常。CDN 目前缺少 0.8.4 版本。