我正在从下面的java脚本创建Gauge图表。我几乎在那里,只想将比例转换为百分比。链接到java脚本 - http://spotfired.blogspot.com/2016/03/custom-gauge-from-calc-value-70.html
JS如下: -
custom gauge from calc value (7.0+)
html:
calculated value:
<span id=calcValue><SpotfireControl id="y0ursp07f1r3c41cV41u3" />
</span>
<HR>
<DIV style="WIDTH: 400px; HEIGHT: 320px" id=gauge></DIV>
js
resource=[
"//cdn.jsdelivr.net/raphael/2.1.0/raphael-min.js",
"//cdn.jsdelivr.net/justgage/1.0.1/justgage.min.js"
]
//add scripts to head
$.getScript(resource[0],function(){
$.getScript(resource[1],init)
})
init = function(){
var g = new JustGage({
id: "gauge",
value: "22",
min: 0,
max: 100,
title: "Visitors"
});
//refresh gauge when calcvalue changes
$(calcValue).on('DOMSubtreeModified',function(){
g.refresh($(this).text())
})
}
非常感谢您的时间和帮助!
最佳, Keyur Parekh