我有这段代码。我不清楚为什么没有显示图表。由于控制台显示它正在绘制但我无法显示它。 我相信我已经添加了容器,但没有出现问题。控制台没有显示任何错误。
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.2/jquery.mobile-
1.4.2.min.css">
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
</head>
<body>
<div data-role="tabs">
<div data-role="navbar">
<ul>
<li><a href="#one" data-theme="a" data-ajax="false">Price Grid</a></li>
<li><a href="#two" data-theme="a" data-ajax="false">Price Chart</a></li>
</ul>
</div>
<div id="one" class="ui-content">
<style>
table,th,td
{
border:1px solid black;
}
th
{
background-color:green;
color:white;
}
</style>
<table id="myTable">
</table>
</div>
<div id="two" style="height:400px;width:300px; "></div>
<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">
$(function(){
$.jqplot('two', [[[1, 2],[3,5.12],[5,13.1],[7,33.6],[9,85.9],[11,219.9]]]);
});
</script>
</div>
</body>
</html>
答案 0 :(得分:2)
首先包括血腥框架,当 jqplot 链接不正确时,您认为它将如何工作? 第二组显示:阻止!重要; 到您的div容器 #two 。
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.css">
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
</head>
<body>
<div data-role="tabs">
<div data-role="navbar">
<ul>
<li><a href="#one" data-theme="a" data-ajax="false">Price Grid</a></li>
<li><a href="#two" data-theme="a" data-ajax="false">Price Chart</a></li>
</ul>
</div>
<div id="one" class="ui-content">
<style>
table,th,td
{
border:1px solid black;
}
th
{
background-color:green;
color:white;
}
#two {
height:400px;
width:300px;
display: block !important;
}
</style>
<table id="myTable">
</table>
</div>
<div id="two" style=""></div>
<script language="javascript" type="text/javascript" src="http://www.jqplot.com/src/jquery.min.js"></script>
<script language="javascript" type="text/javascript" src="http://www.jqplot.com/src/jquery.jqplot.min.js"></script>
<link rel="stylesheet" type="text/css" href="http://www.jqplot.com/src/jquery.jqplot.min.css" />
<script type="text/javascript">
$(function(){
$.jqplot('two', [[[1, 2],[3,5.12],[5,13.1],[7,33.6],[9,85.9],[11,219.9]]]);
});
</script>
</div>
</body>
</html>