我有这个功能:
$(function () {
// declaration
$("#thermogauge").ejLinearGauge({
labelColor: "#8c8c8c", load: "loadGaugeTheme",
height: 400, width: 250, drawLabels: "DrawLabel", drawCustomLabel: "DrawCustomLabel", enableAnimation: false,
scales: [{
type: "thermometer", backgroundColor: "transparent", minimum: -10, maximum: 110, minorIntervalValue: 5, scaleBarSize: 20, position: { x: 50, y: 18 }, length: 200, border: { width: 0.5 },
showCustomLabels: true,
markerPointers: [{ opacity: 0 }],
barPointers: [{
width: 10, distanceFromScale: -0.5,
value: 0, backgroundColor: "#DB3738"
}],
labels: [{
placement: "near", font: { size: "10px", fontFamily: "Segoe UI", fontStyle: "Normal" }
}, {
placement: "far",
distanceFromScale: { x: 10 }
}],
ticks: [{
type: "majorinterval", height: 8, width: 1, color: "#8c8c8c", distanceFromScale: { y: -4 }
}, {
type: "minorinterval", height: 4, width: 1, color: "#8c8c8c", distanceFromScale: { y: -4 }
}, {
type: "majorinterval", placement: "far", height: 8, width: 1, color: "#8c8c8c", distanceFromScale: { y: -4 }
}, {
type: "minorinterval", placement: "far", height: 4, width: 1, color: "#8c8c8c", distanceFromScale: { y: -4 }
}],
customLabels: [{
value: "(° C)",
position: { x: 44, y: 70},
font: "bold 12px Segoe UI", color: "#666666"
}, {
value: "(° F)",
position: { x: 56, y: 70},
font: "bold 12px Segoe UI", color: "#666666"
},
{
position: { x: 51, y: 75},
font: "bold 13px Segoe UI",
color: "#666666"
}]
}]
});
});
我想更改' value'在该函数之后的变量,如下所示:
$('#thermogauge').ejLinearGauge('value', 60);
但它不起作用。我认为其原因在于' barPointers'但我不知道如何改变它...... 你能帮助我吗?
答案 0 :(得分:0)
您可以查看可用的不同功能here,但看起来您需要执行以下操作之一:
$('#thermogauge').data("ejLinearGauge").setBarPointerValue(0,0,30);
$('#thermogauge').data("ejLinearGauge").setIndicatorValue(0,0,30);
$('#thermogauge').data("ejLinearGauge").setPointerValue(0,0,30);