Jquery 隐藏折线图剑道ui中的零值
在折线图中是否有隐藏值为零(0)的数据点?我目前正在使用折线图(剑道),似乎找不到一个简单的方法来做到这一点。基本上,一条线显示在图上的0值处,而我根本不显示这条线。绑定一条线结束值的数据为零(我必须删除它)。示例数据如[30,50,40,75,0] 这里我提供了html代码Jquery 隐藏折线图剑道ui中的零值,jquery,kendo-ui,Jquery,Kendo Ui,在折线图中是否有隐藏值为零(0)的数据点?我目前正在使用折线图(剑道),似乎找不到一个简单的方法来做到这一点。基本上,一条线显示在图上的0值处,而我根本不显示这条线。绑定一条线结束值的数据为零(我必须删除它)。示例数据如[30,50,40,75,0] 这里我提供了html代码 $.ajax({ type: "POST", contentType: "application/json;charset=utf-8",
$.ajax({
type: "POST",
contentType: "application/json;charset=utf-8",
url: "dataVizWebService.asmx/GetSellInOfficeTrends",
dataType: "json",
success: function (data) {
$("#chart").kendoChart({
dataSource: {
data: data.d,
value: "#={0}>0"
},
legend: {
position: "bottom"
},
title: {
text: "Population"
},
series: [
{
type: "line",
field: "Population2010",
name: "Population2010",
axis: "Year",
color: "#4a7ebb"
}, {
type: "line",
field: "Population2011",
name: "Population2011",
axis: "Year",
color: "#be4b48"
}, {
type: "line",
field: "Population2012",
name: "Population2012",
axis: "Year",
color: "#98b954"
}, {
type: "line",
field: "Population2013",
name: "Population2013",
axis: "Year",
dashType: "dash",
color: "#000000"
}
],
valueAxis: [{
name: "Year",
title: { text: "Population in Millions" }
}],
categoryAxis: {
field: "Week",
majorTickType: "none",
labels: {
skip: 0
}
},
tooltip: {
visible: true
}
})
}
});
任何帮助都将不胜感激。您可以连接到数据源的一部分,在那里您可以更改将传递到图表的数据。例如:
function parse(items) {
var item,
result = [];
for (var i = 0; i < items.length; i++) {
item = items[i];
if (item.value !== 0) {
result.push(item);
}
}
return result;
}
$(function() {
var data = [{ value: 30 },{ value: 50 },{ value: 40 },{ value: 75 }, { value: 0 }];
$("#chart").kendoChart({
dataSource: {
data: data,
schema: {
parse: parse
}
},
series: [{
type: "line",
field: "value"
}]
});
});
函数解析(项){
var项目,
结果=[];
对于(变量i=0;i
Kendoui API文档中缺少values属性。您可以使用这些属性并检查对您有用的内容。感谢您的回复,这里我有四行序列,数据来自数据库,其中有五列(第一列是WeekName,第二列是Population2010,Population2011,Population2012,Population2013),在Population2013列数据中我的值为零。该值行(零点)我想隐藏/删除它。是否可以将值返回为null?这将更具语义,并允许您在延迟响应时使用Orry选项。我已经尝试了给定的链接,但显示了带零线的图表。