我正在使用jqplot来制作饼图,我已经使用了jqplot文档中给出的示例代码,但我得到了一些错误,如e.jqplot is undefined,我的代码如下
<script src="jquery-2.0.3.js"></script>
<script type="text/javascript" src='jquery.jqplot.js'></script>
<script type="text/javascript" src="jqplot.pieRenderer.min.js"></script>
<script type="text/javascript" src="jqplot.donutRenderer.min.js"></script>
<script>
$(document).ready(function(){
var data = [
['Heavy Industry', 12],['Retail', 9], ['Light Industry', 14],
['Out of home', 16],['Commuting', 7], ['Orientation', 9]
];
var plot1 = jQuery.jqplot ('weeklyProjectSummary', [data],
{
seriesDefaults: {
// Make this a pie chart.
renderer: jQuery.jqplot.PieRenderer,
rendererOptions: {
// Put data labels on the pie slices.
// By default, labels show the percentage of the slice.
showDataLabels: true
}
},
//legend: { show:true, location: 'e' }
}
);
});
</script>
<div id="weeklyProjectSummary"></div>发布于 2014-08-11 20:54:10
您可能会收到此错误,因为您没有正确包含jqplot文件。
确保已复制代码文件夹中的jquery.jqplot.js、jqplot.pieRenderer.min.js、jqplot.donutRenderer.min.js。
根据我的说法,您已经复制了文件夹中的jquery.jqplot.min.js文件。并且您在HTML代码中包含了jquery.jqplot.js文件
检查一次。如果您已经复制粘贴了文件夹中的缩小文件(.min),则在html <script>标记中更正它。
更改为:<script type="text/javascript" src='jquery.jqplot.min.js'></script> (添加'.min')
致以敬意,
阿尼什
https://stackoverflow.com/questions/25241612
复制相似问题