本例中'值'为5,'maxValue'为39.显示在进度条(a wijmo progressbar)上的值为5.07。 {0}应该告诉进度条显示进度值而不是百分比。如果将该值更改为8,则将最大值保持为39,则显示的值将变为8.19。我有点困惑,为什么我看到浮点数而不是整数。我看不到进度条代码中的任何内容,它将显示除self.value()之外的任何东西,它们以整数形式记录到控制台。那么可能会导致这种行为?为什么我的进度条显示浮点值?
$("#proBarAdherence").wijprogressbar({
value: Gymloop.completedCount,
animationOptions: {
duration: 1000
},
maxValue: Gymloop.targetSessions,
indicatorImage: '/images/progbar_red.png',
labelAlign: 'running',
labelFormatString: '{0} sessions completed',
beforeProgressChanging: function(e,data) {
console.log('beforeprogresschanging',data);
},
progressChanging: function (e,data) {
console.log('progresschanging',data);
},
progressChanged : function (e,data) {
console.log('progresschanged',data);
}
});
beforeprogresschanging Object { oldValue="5", newValue=5}
progresschanging Object { oldValue="5", newValue=0}
progresschanging Object { oldValue="0", newValue=1.17}
progresschanging Object { oldValue="1.17", newValue=1.56}
progresschanging Object { oldValue="1.56", newValue=1.95}
progresschanging Object { oldValue="1.95", newValue=2.34}
progresschanging Object { oldValue="2.34", newValue=2.73}
progresschanging Object { oldValue="2.73", newValue=3.12}
progresschanging Object { oldValue="3.12", newValue=3.51}
progresschanging Object { oldValue="3.51", newValue=3.9}
progresschanging Object { oldValue="3.9", newValue=4.29}
progresschanging Object { oldValue="4.29", newValue=4.68}
progresschanging Object { oldValue="4.68", newValue=5.07}
progresschanged Object { oldValue="5", newValue=5}
更新
我可以progressChanging事件中看到了价值的,但我不知道如何使标签显示5,而不是5.07一旦动画完成?有一个生动的例子here
应该提到,我已经试过了。它没有任何区别。我更新了代码。 – codecowboy
http://wijmo.com/wiki/index.php/Progressbar#Events – Prospero
我做了另一个更新。现在我可以看到浮点数的来源,但不知道如何改变它们。我完成的计数变量不会改变,所以我不确定你的意思是completedCount = round(newValue) – codecowboy