我有一个kendo条形图,我从模型中获取数据并绑定到char。但这里的问题是我无法对订单进行排序。我正在粘贴下面的代码。 Todat认证时间即将到来。对此的任何帮助都非常感谢。
var certData = [{"IronCount":1.65,"TypeWiseData":"Adapter","TestType":"Magnetic Particle Test"},{"IronCount":2.76,"TypeWiseData":"Adapter","TestType":"UT Thickness Test"},{"IronCount":140.37,"TypeWiseData":"Adapter","TestType":"TotalCertificationTime"},{"IronCount":2.02,"TypeWiseData":"Swivel","TestType":"UT Thickness Test"},{"IronCount":2.06,"TypeWiseData":"Swivel","TestType":"Magnetic Particle Test"},{"IronCount":142.67,"TypeWiseData":"Swivel","TestType":"TotalCertificationTime"}];
var dsCertpData = new kendo.data.DataSource({
data: certData,
group: {
field: "TestType",
//dir: "asc"
},
sort:{
field :"IronCount",
dir:"asc"
}
});
$("#chart1").kendoChart({
title: {
text: "Certification Time Per Piece Report",
font: "bold 20px Arial,Helvetica,sans-serif",
color: "brown"
},
//plotArea: {
// background: "#F8F3F3"
//},
dataSource: dsCertpData,
series: [{
type: "column",
categoryField: "TypeWiseData",
field:"IronCount"
}],
valueAxis: {
title: {
text: "Utilization",
font: "bold 15px Arial,Helvetica,sans-serif",
color: "brown"
}
},
categoryAxis:{
title: {
text: "Iron Types",
font: "bold 18px Arial,Helvetica,sans-serif",
color: "brown"
}
},
tooltip: {
visible: true,
template: "${series.name} : ${value}"
}
});
答案 0 :(得分:1)
您可以更换分组:
var dsCertpData = new kendo.data.DataSource({
data: certData,
group: {
field: "TypeWiseData",
},
sort:{
field :"IronCount",
dir:"desc"
}
});
series: [{
type: "column",
categoryField: "TestType",
field:"IronCount"
}],
<强> DEMO 强>