我正在创建一个堆积的条形图,几乎每次,我的图表上的条形图都会溢出。
我不确定是什么导致这种情况,我发现人们在使用chrome排序数据源时遇到了问题,但这并不是特定于chrome。有时取决于我设置的默认排序,它会正确显示,但如果我改变了排序,它会回到搞砸了。最重要的是,有时值会互换,但如果我检查了datasource.data(),它仍然可以。
我试过调用redraw,刷新图表,读取数据源,我在这里有点丢失
感谢您的帮助!
$(document).ready(function () {
var data = {
data: [{"name":"R-24","series":"Moving","Idle":0,"Moving":1396,"Stopped":0,"count":"0.39"},
{"name":"R-25","series":"Moving","Idle":0,"Moving":6795,"Stopped":0,"count":"1.89"},
{"name":"P-24","series":"Moving","Idle":0,"Moving":2622,"Stopped":0,"count":"0.73"},
{"name":"RF-24","series":"Stopped","Idle":0,"Moving":0,"Stopped":796,"count":"0.22"},
{"name":"RF-25","series":"Stopped","Idle":0,"Moving":0,"Stopped":27024,"count":"7.51"},
{"name":"P-24","series":"Stopped","Idle":0,"Moving":0,"Stopped":26430,"count":"7.34"}
],
group: [{
field: 'series'
}],
sort: [{
field: "series",
dir: "asc"
}]
};
$("#chart").kendoChart({
dataSource: data,
series: [{
field: 'count',
stack: true,
type: 'bar'
}],
categoryAxis: [{
field: 'name'
}],
tooltip: {
visible: true,
format: "{0}%",
template: "#= series.name #: #= value #"
}
});
});