[英]kendoui aggregate function for pie chart
我正在嘗試使用聚合函數制作餅圖。 它應顯示類別名稱和該類別中的產品計數。 我不知道如何查找類別的產品計數。
如何找到他們? 謝謝。
var dataSource = new kendo.data.DataSource({ type: "odata", transport: { read: "//demos.telerik.com/kendo-ui/service/Northwind.svc/Categories" }, }); $("#chart").kendoChart({ dataSource: dataSource, legend: { visible: true }, seriesDefaults: { type: "pie" }, series: [{ field: "CategoryID", //it should be product count by category categoryField: "CategoryName", explodeField: "explode", labels: { visible: true, } }], });
<div id="chart"></div>
這樣嘗試
var dataSource = new kendo.data.DataSource({
type: "odata",
transport: {
read: "//demos.telerik.com/kendo-ui/service/Northwind.svc/Categories?$expand=Products"
},
});
$("#chart").kendoChart({
dataSource: dataSource,
legend: {
visible: true
},
series: [{
type: "pie",
field: "Products.results.length",
categoryField: "CategoryName",
explodeField: "explode",
labels: {
visible: true,
}
}]
});
閱讀有關odata expand的信息,並獲取標量導航屬性的計數,以進一步了解細節
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.