Kendo ui 剑道图基本装订
我是剑道图新手,我想在我的MVC项目中实现它。我正在使用剑道版本Kendo ui 剑道图基本装订,kendo-ui,kendo-asp.net-mvc,Kendo Ui,Kendo Asp.net Mvc,我是剑道图新手,我想在我的MVC项目中实现它。我正在使用剑道版本2012.3.1315.340 控制器: public ActionResult KendoChart() { return View(); } public ActionResult GetTaskAllz() { dbipathEntities1 objContext = new dbipathEntities1(); List<mdlChart> objLst = new List<mdlCh
2012.3.1315.340
控制器:
public ActionResult KendoChart()
{
return View();
}
public ActionResult GetTaskAllz()
{
dbipathEntities1 objContext = new dbipathEntities1();
List<mdlChart> objLst = new List<mdlChart>();
List<tblPurchaseOrder> objLst1 = new List<tblPurchaseOrder>();
var objMdl1 = (from c in objContext.tblPurchaseOrders select c).Take(100).OrderBy(x => x.POID).ToList();
objLst1 = objMdl1.ToList<tblPurchaseOrder>();
for (int i = 0; i < objLst1.Count; i++)
{
objLst.Add(new mdlChart { JobNo = objLst1[i].JobID, SupplierID = objLst1[i].SupplierID });
}
return Json(objLst1, JsonRequestBehavior.AllowGet);
}
public class mdlChart
{
public Nullable<int> JobNo { get; set; }
public Nullable<int> SupplierID { get; set; }
}
<link rel="stylesheet" href="@Url.Content("~/Kendo/kendo.common.min.css")" />
<link rel="stylesheet" href="@Url.Content("~/Kendo/kendo.rtl.min.css")" />
<link rel="stylesheet" href="@Url.Content("~/Kendo/kendo.default.min.css")" />
<link rel="stylesheet" href="@Url.Content("~/Kendo/examples-offline.css")" />
<script src="../../Kendo/Jquery-1.8.3.min.js" type="text/javascript"></script>
<script src="@Url.Content("~/Kendo/kendo.web.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Kendo/kendo.aspnetmvc.min.js")" type="text/javascript"> </script>
<script src="@Url.Content("~/Kendo/console.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Kendo/prettify.min.js")" type="text/javascript"></script>
<script src="../../Kendo/kendo.culture.en-GB.min.js" type="text/javascript"></script>
<script type="text/javascript">
//set current to the "en-GB" culture script
kendo.culture("en-GB");
</script>
@using Kendo.Mvc.UI
@(Html.Kendo().Chart<MVCProject.Models.mdlChart>()
.Name("chart")
.Title("Pop In Accounts")
.Legend(legend => legend
.Position(ChartLegendPosition.Top)
)
.DataSource(ds => ds.Read(read => read.Action("GetTaskAllz", "Kendo")))
.Series(series =>
{
series.Column(model => model.JobNo).Name("Val2");
})
.CategoryAxis(axis => axis
.Categories(model => model.SupplierID)
.Labels(labels => labels.Rotation(-90))
)
)
出现上述错误的Javascript自动生成代码:
jQuery(
function () {
debugger;
jQuery("#chart").kendoChart(
{ "title": { "text": "Pop In Accounts" },
"legend": { "position": "top" },
"series": [{ "name": "Val2", "type": "column", "field": "JobNo"}],
"categoryAxis": [{ "labels": { "rotation": -90 }, "field": "SupplierID"}],
"dataSource": { "transport": { "prefix": "", "read": { "url": "/Kendo/GetTaskAllz", "type": "POST"} },
"type": "aspnetmvc-ajax",
"schema":
{ "model":
{ "fields":
{ "JobNo":
{ "type": "number", "defaultValue": null },
"SupplierID": { "type": "number", "defaultValue": null }
}
}
}
}
});
});
您应该包括“kendo.all.min.js”。“kendo.web.min.js”不包括kendouidataviz小部件。更多信息可在中找到。已解决!!只是用下面的脚本替换上面的脚本
<script src="../../Kendo/Jquery-1.8.3.min.js" type="text/javascript"></script>
<link href="../../Kendo/kendo.dataviz.min.css" rel="stylesheet" type="text/css" />
<script src="../../Kendo/kendo.dataviz.min.js" type="text/javascript"></script>
感谢您编辑我的代码,但您能为我提供一些解决方案吗。
<script src="../../Kendo/Jquery-1.8.3.min.js" type="text/javascript"></script>
<link href="../../Kendo/kendo.dataviz.min.css" rel="stylesheet" type="text/css" />
<script src="../../Kendo/kendo.dataviz.min.js" type="text/javascript"></script>