我有一个像这样定义的剑道线性测量仪......
$("#gauge").kendoLinearGauge({
pointer: {
value: 4.5,
shape: "arrow"
},
scale: {
majorUnit: 1,
minorUnit: 1,
max: 6,
ranges: [
{
from: 0,
to: 1,
color: "#ffc700"
}, {
from: 1,
to: 2,
color: "#ff7a00"
}, {
from: 2,
to: 3,
color: "#c20000"
}, {
from: 3,
to: 4,
color: "#FF0000"
}, {
from: 4,
to: 5,
color: "#00FF00"
}, {
from: 5,
to: 6,
color: "#0000FF"
}
]
}
});
这会产生一个看起来像这样的仪表......
我想要做的是将数字标签替换为字符串值,例如“未验证”,“已验证”,“打开”等,这样我最终会得到更类似于此的内容...... < / p>
我相信我应该能够使用模板执行此操作,但我无法获得最简单的示例(包括telerik网站下面显示的示例)工作
$("#linear-gauge").kendoLinearGauge({
scale: {
labels: {
// labels template
template: "#= value #%"
}
}
});
有人可以提出任何建议吗?
答案 0 :(得分:1)
创建模板功能
template: function (rec) {
var label;
switch (rec.value) {
case 0:
label = 'un verified';
break;
case 1:
label = 'verified';
break;
default:
label = 'open';
}
return label;
}