我在项目中导入jqPlot,如下所示:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script language="javascript" type="text/javascript" src="../js/jqplot/jquery.min.js"></script>
<script language="javascript" type="text/javascript" src="../js/jqplot/jquery.jqplot.min.js"></script>
<link rel="stylesheet" type="text/css" href="../js/jqplot/jquery.jqplot.css" />
<script type="text/javascript">
$.jqplot('chartdiv', [[[1, 2],[3,5.12],[5,13.1],[7,33.6],[9,85.9],[11,219.9]]]);
</script>
</head>
<body>
<div id="chartdiv" style="height:400px;width:300px; "></div>
</body>
</html>我在Chrome中打开了这个html页面,但是有一条错误消息:
$.jqplot('chartdiv',[[1,2,3,5.12,13.1,7,33.6,9,85.9,11,219.9]); 未定义的TypeError:不能调用未定义的方法'jqplot‘
我不太清楚原因。
发布于 2012-11-24 07:47:41
jqplot抛出一个异常:
Uncaught No plot target specified 这意味着它无法找到要放置图表的位置,因为DOM还没有准备好。您可以通过在jQuery函数中封装对jQuery的调用来修复它。
$(function(){
$.jqplot('chartdiv', [[[1, 2],[3,5.12],[5,13.1],[7,33.6],[9,85.9],[11,219.9]]]);
});例子:http://jsfiddle.net/jaimem/6ds84/
https://stackoverflow.com/questions/13539258
复制相似问题