gpt4 book ai didi

javascript - Spotfire Javascript 输出消失

转载 作者:行者123 更新时间:2023-11-28 04:24:30 26 4
gpt4 key购买 nike

我在 Spotfire 文本区域中有一个小的 javascript。它按设计工作。我保存并关闭了 Spotfire。重新打开时根本不显示。我的代码如下。任何帮助将不胜感激。

resource = [
"//cdn.rawgit.com/toorshia/justgage/master/raphael-2.1.4.min.js",
"//cdnjs.cloudflare.com/ajax/libs/justgage/1.2.8/justgage.js"
]

//add scripts to head
$.getScript(resource[0], function() {
$.getScript(resource[1], init)
})

var init = function() {
var g = new JustGage({
id: "gauge",
min: 0,
max: 100,
customSectors: [{
"lo": 0,
"hi": 89.999,
"color": "#f05050"
},
{
"lo": 90,
"hi": 92.999,
"color": "#DD7502"
},
{
"lo": 93,
"hi": 100,
"color": "#41c572"
}
],
levelColorsGradient: false
});
//refresh gauge when calcvalue changes
$(calcValue).on('DOMSubtreeModified', function() {
g.refresh($(this).text())
})
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<span id=calcValue><SpotfireControl id="3321e4c9003142ad83fdb753e6f66605" />
</span>
<DIV id=gauge></DIV>

最佳答案

我看了例子,应该是:

resource = [
"//cdn.rawgit.com/toorshia/justgage/master/raphael-2.1.4.min.js",
"//cdnjs.cloudflare.com/ajax/libs/justgage/1.2.8/justgage.js"
]

//add scripts to head
$.getScript(resource[0], function() {
$.getScript(resource[1], init)
})

var init = function() {
var g = new JustGage({
id: "gauge",
min: 0,
max: 100,
customSectors: {ranges: [{
"lo": 0,
"hi": 89.999,
"color": "#f05050"
},
{
"lo": 90,
"hi": 92.999,
"color": "#DD7502"
},
{
"lo": 93,
"hi": 100,
"color": "#41c572"
}
]},
levelColorsGradient: false
});
//refresh gauge when calcvalue changes
//$(calcValue).on('DOMSubtreeModified', function() {
// g.refresh($(this).text())
//})
window.setInterval( () => {
g.refresh(Math.random()*100)
}, 1000)
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<span id=calcValue><SpotfireControl id="3321e4c9003142ad83fdb753e6f66605" />
</span>
<DIV id=gauge></DIV>

关于javascript - Spotfire Javascript 输出消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45178925/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com