Javascript JQPlot图表未显示
我已经检查了其他类似的问题,但仍然无法找到问题的根源 代码如下:Javascript JQPlot图表未显示,javascript,jqplot,Javascript,Jqplot,我已经检查了其他类似的问题,但仍然无法找到问题的根源 代码如下: <!DOCTYPE html> <html> <head> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script type="text/javascript" src="resour
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="resources/jquery/jquery.jqplot.js"></script>
<link rel="stylesheet" type="text/css" href="resources/jquery/jquery.jqplot.css" />
</head>
<body>
<div id="chart2" style="height:300px;width:500px; "></div>
</body>
<script type='text/javascript'>
$(document).ready(function() {
var line1 = [['Nissan', 4],['Porche', 6],['Acura', 2],['Aston Martin', 5],['Rolls Royce', 6]];
$('#chart2').jqplot([line1], {
title:'Bar Chart with Varying Colors',
seriesDefaults:{
renderer:$.jqplot.BarRenderer,
rendererOptions: {
// Set the varyBarColor option to true to use different colors for each bar.
// The default series colors are used.
varyBarColor: true
}
},
axes:{
xaxis:{
renderer: $.jqplot.CategoryAxisRenderer
}
}
});
});
</script>
</html>
$(文档).ready(函数(){
var line1=[[Nissan',4],[Porche',6],[Acura',2],[Aston Martin',5],[Rolls-Royce',6];
$('图表2').jqplot([line1]{
标题:“不同颜色的条形图”,
系列默认值:{
渲染器:$.jqplot.blunderer,
渲染器选项:{
//将varyBarColor选项设置为true,以便为每个条使用不同的颜色。
//使用默认系列颜色。
瓦里巴科洛尔:真的
}
},
轴线:{
xaxis:{
渲染器:$.jqplot.CategoryAxisRenderer
}
}
});
});
问题是,除了图表画布之外,什么也不显示。控制台中没有记录错误,源文件已加载。我将.jqplot调用移到chart2div下面,因为一个用户认为这是必要的,尽管我不认为是这样,因为我们正在使用$(document).ready(function()
知道问题在哪里吗?已解决
需要包括在调用.jqplot中指定的其他渲染器
<script type="text/javascript" src="resources/jquery/plugins/jqplot.barRenderer.js"></script>
<script type="text/javascript" src="resources/jquery/plugins/jqplot.categoryAxisRenderer.js"></script>