Jquery jqplot饼图未正确呈现。
获取日志消息:饼图直径太小,无法渲染 然后,当我在页面内悬停或单击时,似乎会得到:Uncaught TypeError:无法读取未定义的属性“0”Jquery jqplot饼图未正确呈现。,jquery,jquery-plugins,jqplot,Jquery,Jquery Plugins,Jqplot,获取日志消息:饼图直径太小,无法渲染 然后,当我在页面内悬停或单击时,似乎会得到:Uncaught TypeError:无法读取未定义的属性“0” <link href="/Content/jqPlot/jquery.jqplot.css" rel="stylesheet" type="text/css" /> <script src="/Scripts/jquery.jqplot.js" type="text/javascript"></scrip
<link href="/Content/jqPlot/jquery.jqplot.css" rel="stylesheet" type="text/css" />
<script src="/Scripts/jquery.jqplot.js" type="text/javascript"></script>
<script src="/Scripts/jqplot.pieRenderer.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
//GetWeeklyProjectSummary();
Test();
});
function Test() {
var data = [["987 Project",74],["ABC Project",68],["XYZ project",26]];
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>
$(函数(){
//GetWeeklyProjectSummary();
Test();
});
功能测试(){
var数据=[“987项目”,74],“ABC项目”,68],“XYZ项目”,26];
var plot1=jQuery.jqplot('weeklyProjectSummary',[data],
{
系列默认值:{
//做一个饼图。
渲染器:jQuery.jqplot.pierender,
渲染器选项:{
//在饼图切片上放置数据标签。
//默认情况下,标签显示切片的百分比。
showDataLabels:true
}
},
图例:{show:true,位置:'e'}
}
);
}
这是它要进入的部门:
<div id="weeklyProjectSummary"></div>
以下是我在页面上看到的内容:
如果您需要更多详细信息,请告诉我。您的JQPlot图表定义似乎正确。饼图在我的屏幕上正确呈现 我没有看到包含jquery.js或jquery.min.js。你能确认你的代码中有对这个文件的引用吗
此外,请确认所有js/css文件都被正确引用(您可以使用快速确认它们确实包含在内)。我在将jqplot与blueprintcss一起使用时遇到类似问题-根据您的屏幕截图,我相信您正在使用blueprintcss 尝试删除以下行:
legend: { show: true, location: 'e' }
并查看它是否正确渲染
(编辑:更多信息请参见:
)包括canvas.min.js。您可以在下载的示例中找到它。我在legend中使用了它。我在我的CSS文件中添加了以下行: .jqplot表图例{width:auto;} 从jqplot css文件重载属性
为我工作。我只想从以下方面扩展答案: 我面临同样的问题,我使用了上述答案,并做了一些小的修改:
<style type="text/css">
#chartComponentId table.jqplot-table-legend { width: auto !important;}
</style>
<div id="chartComponentId" class="chartComponent">
...
</div>
#chartComponentId table.jqplot-table-legend{宽度:auto!重要;}
...
由于使用的需要!重要信息,将此样式表绑定到特定的div对象上可防止对其他元素产生任何副作用。您好,我遇到了“未捕获的TypeError:无法读取未定义的属性'Pierender'”这个问题。您能帮我解决吗。我添加了所有的东西,这解决了与基础CSS在网站上相同的错误。