我正在尝试在 ASP.NET MVC 项目(使用 DevExpress)中显示带有 jQuery 绑定的 dxChart。所以我在 rootLayout 中包含了必要的脚本:
<script src="@Url.Content("~/Scripts/jquery-1.10.2.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/bootstrap.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/knockout-3.0.0.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/globalize.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/dx.chartjs.js")" type="text/javascript"></script>
然后我在局部视图中添加了 div 标签和绑定脚本:
<div id='chartContainer'></div>
<script>
$(function() {
var dataSource = @Html.Raw(Model.RepartitionDesRdvs);
$("#chartContainer").dxChart({
size: {
width: 300
},
dataSource: dataSource,
commonSeriesSettings: {
argumentField: 'Statut',
type: 'pie'
},
series: [
{
argumentField: "Statut",
valueField: "Total",
label: {
visible: true,
connector: {
visible: true,
width: 1
}
}
}
],
title: "Répartition des Rendez Vous",
onPointClick: function (e) {
var point = e.target;
point.isVisible() ? point.hide() : point.show();
}
});
});
</script>
视图中没有显示任何内容,我收到此错误:
TypeError: $(...).dxChart is not a function
我错过了什么?