本例中'值'爲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