[英]My Jqplot pie chart is being displayed without any color for the small table inside the pie chart
我在我的 asp.net MVC 3 web 應用程序中使用 Jqplot 餅圖,但問題是餅圖中包含圖表 ZD304BA20E96D87411588EEABAC850E3 的小表格沒有顯示任何顏色。 那么我該如何解決這個問題呢? 提前感謝您的幫助。 BR
已編輯
感謝您的友好回復,是的,我已經包含了這些文件,但仍然沒有顯示 colors。 這是我的 MVC 3 asp.net web 應用程序中的代碼(餅圖顯示了兩個值;喜歡測試的學生與未提供任何評分的學生的百分比)。
<script src="../../Scripts/jqplot/jquery.jqplot.min.js" type="text/javascript"></script>
<script src="../../Scripts/jqplot/jqplot.pieRenderer.min.js" type="text/javascript"></script>
<script src="../../Scripts/jqplot/jqplot.donutRenderer.min.js" type="text/javascript"></script>
<script src="../../Scripts/jqplot/jqplot.barRenderer.min.js" type="text/javascript"></script>
<script src="../../Scripts/jqplot/jqplot.categoryAxisRenderer.min.js" type="text/javascript"></script>
<script src="../../Scripts/jqplot/jqplot.pointLabels.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
var data = [
['Number of Like', @ViewBag.CountRate], ['Other', @ViewBag.other]
];
var plot1 = jQuery.jqplot('r1', [data],
{
seriesDefaults: {
renderer: jQuery.jqplot.PieRenderer,
rendererOptions: {
showDataLabels: true
}
},
legend: { show: true, location: 'e' }
}
);
});
</script>
<div id = "r1"></div>
jqPlot文檔沒有非常強烈地提到它,但它確實提到了包含 css 文件
To use jqPlot include jquery, the jqPlot jQuery plugin, jqPlot css file and optionally the excanvas script for IE support in your web page
所以你需要包括jquery.jqplot.min.css
例如
<link rel="stylesheet" href="/jqplot/jquery.jqplot.min.css">
Also jqPlot recommends using css to customize colors etc see http://www.jqplot.com/docs/files/jqPlotCssStyling-txt.html
您是否正在加載所有必需的 js 文件? 聽起來你好像失蹤了:
jqplot.pointLabels.min.js
添加這些:
("~/scripts/jqPlot/jquery.jqplot.min.js")
("~/scripts/jqPlot/plugins/jqplot.pieRenderer.min.js")
("~/scripts/jqPlot/plugins/jqplot.donutRenderer.min.js")
("~/scripts/jqPlot/plugins/jqplot.barRenderer.min.js")
("~/scripts/jqPlot/plugins/jqplot.categoryAxisRenderer.min.js")
("~/scripts/jqPlot/plugins/jqplot.pointLabels.min.js")
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.