目前,我有一个线性仪表,如下所示:
$("#depthBar-" + conveyanceId).kendoLinearGauge({
pointer: {
value: 0,
shape: "arrow",
color: "transparent",
start: 0,
reverse: true
},
scale: {
majorUnit: 500,
minorUnit: 100,
min: -2000,
max: 2000,
vertical: false,
reverse: false,
ranges: [
{
from: -2000, // LimitLo
to: -1500,
color: "#ffc700"
},
{
from: 2000, // LimitHi
to: 1500,
color: "#ffc700"
}, {
from: 2000, // LimitHiHi
to: 1800,
color: "#c20000"
}, {
from: -5000,
to: -1800,
color: "#c20000" // LimitLoLo
}, {
from: 0,
to: 286,
color: "lightblue"
}
]
}
});
我想要做的是动态更新最后一个范围的“到”值(使用浅蓝色作为颜色的那个)。但是,我似乎无法弄清楚如何更新该属性。这就是我目前正在查找该属性的方式:
$('#depthBar-' + conveyanceId).data("kendoLinearGauge").options.scale.ranges[4].to = newVal;
然而,这似乎并没有奏效。如果我将整个语句分配给一个 tmp 变量并在 Chrome 调试器中检查它,我会得到我正在寻找的正确范围。只是无法使用新值设置“to”属性。有什么建议么?